-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsentry.server.config.ts
More file actions
41 lines (32 loc) · 991 Bytes
/
sentry.server.config.ts
File metadata and controls
41 lines (32 loc) · 991 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
37
38
39
40
41
// 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 isProduction = process.env.NODE_ENV === "production";
const isDevelopment = process.env.NODE_ENV === "development";
const getEnvironmentConfig = () => {
if (isProduction) {
return {
tracesSampleRate: 0.1,
sampleRate: 1.0,
enableLogs: false,
};
}
if (isDevelopment) {
return {
tracesSampleRate: 1.0,
sampleRate: 1.0,
enableLogs: true,
debug: true,
};
}
};
const config = getEnvironmentConfig();
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
environment: process.env.NODE_ENV,
...config,
// Enable sending user PII (Personally Identifiable Information)
// https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii
sendDefaultPii: false,
});