File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,9 @@ const globalWithInjectedValues = global as typeof global & {
3838export function init ( options : BrowserOptions ) : void {
3939 applyTunnelRouteOption ( options ) ;
4040 buildMetadata ( options , [ 'nextjs' , 'react' ] ) ;
41- options . environment = options . environment || process . env . NODE_ENV ;
41+
42+ options . environment = options . environment || process . env . NEXT_PUBLIC_VERCEL_ENV || process . env . NODE_ENV ;
43+
4244 addClientIntegrations ( options ) ;
4345
4446 reactInit ( options ) ;
Original file line number Diff line number Diff line change @@ -46,9 +46,8 @@ export function init(options: EdgeOptions = {}): void {
4646 }
4747 }
4848
49- if ( options . environment === undefined && process . env . SENTRY_ENVIRONMENT ) {
50- options . environment = process . env . SENTRY_ENVIRONMENT ;
51- }
49+ options . environment =
50+ options . environment || process . env . SENTRY_ENVIRONMENT || process . env . VERCEL_ENV || process . env . NODE_ENV ;
5251
5352 if ( options . autoSessionTracking === undefined && options . dsn !== undefined ) {
5453 options . autoSessionTracking = true ;
Original file line number Diff line number Diff line change @@ -79,7 +79,10 @@ export function init(options: NodeOptions): void {
7979 }
8080
8181 buildMetadata ( options , [ 'nextjs' , 'node' ] ) ;
82- options . environment = options . environment || process . env . NODE_ENV ;
82+
83+ options . environment =
84+ options . environment || process . env . SENTRY_ENVIRONMENT || process . env . VERCEL_ENV || process . env . NODE_ENV ;
85+
8386 addServerIntegrations ( options ) ;
8487 // Right now we only capture frontend sessions for Next.js
8588 options . autoSessionTracking = false ;
You can’t perform that action at this time.
0 commit comments