-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The configuration for the server needs to be imported from a next.js instrumentation file `instrumentation.js|ts`. As we're not using edge runtime, neither `sentry.edge.config` or an additional branch in `instrumentation.js` is needed. Setting a `sentry` property on the Next.js config object as a means of configuration is no longer supported. The `sentryBuildOptions` argument of the `withSentryConfig()` function instead must be used instead.
- Loading branch information
1 parent
1d8edf3
commit 2a293f0
Showing
2 changed files
with
37 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as Sentry from "@sentry/nextjs"; | ||
|
||
const SENTRY_DSN = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN; | ||
|
||
export function register() { | ||
if (process.env.NEXT_RUNTIME === "nodejs") { | ||
Sentry.init({ | ||
dsn: SENTRY_DSN, | ||
}); | ||
} | ||
|
||
// In case the edge runtime is used: | ||
// 1. Create a sentry.edge.config file | ||
// 2. Uncomment the following lines | ||
// if (process.env.NEXT_RUNTIME === "edge") { | ||
// Sentry.init({ | ||
// dsn: SENTRY_DSN, | ||
// }); | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters