Skip to content

Scheduling infrastructure for absolutely everyone.

chore: improve instrumentation deps (#16899)

Alex van Andel0d7f560c432b
diff --git a/apps/web/instrumentation.ts b/apps/web/instrumentation.ts
index 79040c9dbb1..b0bba123cc7 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 00000000000..842f09fccc2
--- /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 00000000000..842f09fccc2
--- /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,
+});