-
Notifications
You must be signed in to change notification settings - Fork 2
/
instrumentation.ts
28 lines (22 loc) · 999 Bytes
/
instrumentation.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import * as Sentry from "@sentry/nextjs"
/**
* Load our package.json so that we can access the version
* and allow Sentry to track errors in relation to the version used
*/
// tslint:disable-next-line:no-var-requires
const packageJson = require("./package.json")
export function register() {
if (process.env.NEXT_RUNTIME === "nodejs" || process.env.NEXT_RUNTIME === "edge") {
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN ?? "__dsn__",
spotlight: process.env.NODE_ENV === "development",
release: `v${packageJson.version}`,
// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 0.05,
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
})
}
}
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#errors-from-nested-react-server-components
export const onRequestError = Sentry.captureRequestError