-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsentry.server.config.ts
More file actions
35 lines (28 loc) · 1.18 KB
/
sentry.server.config.ts
File metadata and controls
35 lines (28 loc) · 1.18 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
27
28
29
30
31
32
33
34
35
// biome-ignore lint/performance/noNamespaceImport: Sentry SDK requires namespace import
import * as Sentry from '@sentry/nextjs';
const dsn = process.env.SENTRY_DSN ?? process.env.NEXT_PUBLIC_SENTRY_DSN;
const sentryEnabled = Boolean(dsn) && process.env.NEXT_PUBLIC_SENTRY_ENABLED !== 'false';
const sentryDebug = process.env.NEXT_PUBLIC_SENTRY_DEBUG === 'true';
Sentry.init({
environment: process.env.SENTRY_ENVIRONMENT ?? process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT ?? process.env.NODE_ENV,
dsn,
// Enable whenever DSN exists unless explicitly disabled
enabled: sentryEnabled,
// Opt-in verbose SDK logs when troubleshooting
debug: sentryDebug,
// Sample rate for error events
sampleRate: 1.0,
// Disable performance monitoring
tracesSampleRate: 0,
// Scrub sensitive data
beforeSend(event) {
// Filter out sensitive headers
if (event.request?.headers) {
// biome-ignore lint/performance/noDelete: Need to remove headers entirely for privacy
delete event.request.headers.authorization;
// biome-ignore lint/performance/noDelete: Need to remove headers entirely for privacy
delete event.request.headers.cookie;
}
return event;
},
});