@@ -5,23 +5,29 @@ import { nodeProfilingIntegration } from '@sentry/profiling-node';
55/**
66 * Sentry configuration
77 */
8- const SENTRY_DSN = getRequiredEnvString ( 'SENTRY_DSN' ) ;
8+ const SENTRY_DSN = process . env [ 'SENTRY_DSN' ] ;
99const SENTRY_ENVIRONMENT = 'production' ;
1010const SENTRY_RELEASE = 'v1.0.0' ;
1111
12- // Initialize Sentry
13- console . info ( '[INFO][SENTRY][INIT] Initializing Sentry error reporting' ) ;
14- Sentry . init ( {
15- dsn : SENTRY_DSN ,
16- environment : SENTRY_ENVIRONMENT ,
17- release : SENTRY_RELEASE ,
18- sendDefaultPii : true ,
19- tracesSampleRate : 1.0 ,
20- profileSessionSampleRate : 1.0 ,
21- profileLifecycle : 'trace' ,
22- integrations : [
23- nodeProfilingIntegration ( ) ,
24- Sentry . graphqlIntegration ( { useOperationNameForRootSpan : true } ) ,
25- ] ,
26- debug : false ,
27- } ) ;
12+ if ( ! SENTRY_DSN || SENTRY_DSN . trim ( ) === '' ) {
13+ console . info (
14+ '[INFO][SENTRY][LOG] Not using Sentry as it is disabled by not setting SENTRY_DSN env var' ,
15+ ) ;
16+ } else {
17+ // Initialize Sentry
18+ console . info ( '[INFO][SENTRY][INIT] Initializing Sentry error reporting' ) ;
19+ Sentry . init ( {
20+ dsn : SENTRY_DSN ,
21+ environment : SENTRY_ENVIRONMENT ,
22+ release : SENTRY_RELEASE ,
23+ sendDefaultPii : true ,
24+ tracesSampleRate : 1.0 ,
25+ profileSessionSampleRate : 1.0 ,
26+ profileLifecycle : 'trace' ,
27+ integrations : [
28+ nodeProfilingIntegration ( ) ,
29+ Sentry . graphqlIntegration ( { useOperationNameForRootSpan : true } ) ,
30+ ] ,
31+ debug : false ,
32+ } ) ;
33+ }
0 commit comments