-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsentry.server.config.ts
More file actions
26 lines (19 loc) · 1.06 KB
/
Copy pathsentry.server.config.ts
File metadata and controls
26 lines (19 loc) · 1.06 KB
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
// This file configures the initialization of Sentry on the server.
// The config you add here will be used whenever the server handles a request.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
import * as Sentry from "@sentry/nextjs";
const nodeMajorVersion = Number.parseInt(process.versions.node.split(".")[0] ?? "0", 10);
const shouldDisableDeprecatedEsmLoaderHooks = nodeMajorVersion >= 26;
Sentry.init({
dsn: process.env.SENTRY_DSN,
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
tracesSampleRate: 1,
// Sentry currently registers ESM import hooks through Node's deprecated
// module.register() API, which emits DEP0205 on Node 26+.
...(shouldDisableDeprecatedEsmLoaderHooks ? { registerEsmLoaderHooks: false } : {}),
// Enable logs to be sent to Sentry
enableLogs: true,
// Enable sending user PII (Personally Identifiable Information)
// https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii
sendDefaultPii: true,
});