diff --git a/packages/nextjs/src/index.client.ts b/packages/nextjs/src/index.client.ts index f47f43dc6b88..1c792523148c 100644 --- a/packages/nextjs/src/index.client.ts +++ b/packages/nextjs/src/index.client.ts @@ -9,6 +9,7 @@ export * from '@sentry/react'; export function init(options: NextjsOptions): void { const metadataBuilder = new MetadataBuilder(options, ['nextjs', 'react']); metadataBuilder.addSdkMetadata(); + options.environment = options.environment || process.env.NODE_ENV; reactInit(options); configureScope(scope => { scope.setTag('runtime', 'browser'); diff --git a/packages/nextjs/src/index.server.ts b/packages/nextjs/src/index.server.ts index d563ffec10ce..356e2c804e75 100644 --- a/packages/nextjs/src/index.server.ts +++ b/packages/nextjs/src/index.server.ts @@ -15,6 +15,7 @@ export { ErrorBoundary, withErrorBoundary } from '@sentry/react'; export function init(options: NextjsOptions): void { const metadataBuilder = new MetadataBuilder(options, ['nextjs', 'node']); metadataBuilder.addSdkMetadata(); + options.environment = options.environment || process.env.NODE_ENV; if (options.integrations) { options.integrations = getFinalServerIntegrations(options.integrations); } else {