Skip to content

Commit

Permalink
Remove Sentry from direct import in instrumentation file
Browse files Browse the repository at this point in the history
  • Loading branch information
emrysal committed Oct 1, 2024
1 parent 1377f1a commit 492d8a5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
12 changes: 3 additions & 9 deletions apps/web/instrumentation.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import * as Sentry from "@sentry/nextjs";

export function register() {
export async function register() {
if (process.env.NEXT_RUNTIME === "nodejs") {
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
});
await import("./sentry.server.config");
}

if (process.env.NEXT_RUNTIME === "edge") {
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
});
await import("./sentry.edge.config");
}
}
5 changes: 5 additions & 0 deletions apps/web/sentry.edge.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as Sentry from "@sentry/nextjs";

Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
});
5 changes: 5 additions & 0 deletions apps/web/sentry.server.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as Sentry from "@sentry/nextjs";

Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
});

0 comments on commit 492d8a5

Please sign in to comment.