-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathsentry.server.config.ts
More file actions
36 lines (30 loc) · 963 Bytes
/
sentry.server.config.ts
File metadata and controls
36 lines (30 loc) · 963 Bytes
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
36
// 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";
import { config } from "./src/config";
if (!config.errorTrackingDsn) {
console.warn(
"Sentry is not initialized because ERROR_TRACKING_DSN is not set.",
);
} else {
Sentry.init({
dsn: config.errorTrackingDsn,
debug: false,
release: process.env.NEXT_PUBLIC_VERSION,
beforeSend(event) {
if (event.request && event.request.cookies) {
delete event.request.cookies;
}
if (event.request && event.request.headers) {
delete event.request.headers.cookie;
}
// remove user ip from event
if (event.user && event.user.ip_address) {
delete event.user.ip_address;
}
return event;
},
sendDefaultPii: false,
});
}