Skip to content

Commit 80b5a59

Browse files
n3rdc4ptnCopilot
andauthored
Update server.js
Co-authored-by: Copilot <[email protected]>
1 parent bad4845 commit 80b5a59

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

server.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@ import * as Sentry from '@sentry/node';
1111

1212
dotenv.config();
1313

14-
Sentry.init({
15-
dsn: process.env.BFF_SENTRY_DSN,
16-
// Setting this option to true will send default PII data to Sentry.
17-
// For example, automatic IP address collection on events
18-
sendDefaultPii: true,
19-
environment: process.env.VITE_ENVIRONMENT,
20-
});
14+
if (!process.env.BFF_SENTRY_DSN || process.env.BFF_SENTRY_DSN.trim() === '') {
15+
console.error('Error: Sentry DSN is not provided. Sentry will not be initialized.');
16+
} else {
17+
Sentry.init({
18+
dsn: process.env.BFF_SENTRY_DSN,
19+
// Setting this option to true will send default PII data to Sentry.
20+
// For example, automatic IP address collection on events
21+
sendDefaultPii: true,
22+
environment: process.env.VITE_ENVIRONMENT,
23+
});
24+
}
2125

2226
const isLocalDev = process.argv.includes('--local-dev');
2327

0 commit comments

Comments
 (0)