diff --git a/apps/web/instrumentation.ts b/apps/web/instrumentation.ts index 79040c9dbb..b0bba123cc 100644 --- a/apps/web/instrumentation.ts +++ b/apps/web/instrumentation.ts @@ -1,15 +1,9 @@ -import * as Sentry from "@sentry/nextjs"; - -export function register() { - if (process.env.NEXT_RUNTIME === "nodejs") { - Sentry.init({ - dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, - }); +export async function register() { + if (process.env.NEXT_PUBLIC_SENTRY_DSN && process.env.NEXT_RUNTIME === "nodejs") { + await import("./sentry.server.config"); } - if (process.env.NEXT_RUNTIME === "edge") { - Sentry.init({ - dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, - }); + if (process.env.NEXT_PUBLIC_SENTRY_DSN && process.env.NEXT_RUNTIME === "edge") { + await import("./sentry.edge.config"); } } diff --git a/apps/web/sentry.edge.config.ts b/apps/web/sentry.edge.config.ts new file mode 100644 index 0000000000..842f09fccc --- /dev/null +++ b/apps/web/sentry.edge.config.ts @@ -0,0 +1,5 @@ +import * as Sentry from "@sentry/nextjs"; + +Sentry.init({ + dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, +}); diff --git a/apps/web/sentry.server.config.ts b/apps/web/sentry.server.config.ts new file mode 100644 index 0000000000..842f09fccc --- /dev/null +++ b/apps/web/sentry.server.config.ts @@ -0,0 +1,5 @@ +import * as Sentry from "@sentry/nextjs"; + +Sentry.init({ + dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, +});