From 56f0423d5adfbb009bab1a436804eae4e06b0b69 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Thu, 19 Mar 2026 17:29:09 +0100 Subject: [PATCH] Enable Sentry only for non-local environments --- web/instrumentation-client.ts | 4 +++- web/sentry.edge.config.ts | 4 +++- web/sentry.server.config.ts | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/web/instrumentation-client.ts b/web/instrumentation-client.ts index 4ad38d0a..7a58933a 100644 --- a/web/instrumentation-client.ts +++ b/web/instrumentation-client.ts @@ -3,7 +3,7 @@ // https://docs.sentry.io/platforms/javascript/guides/nextjs/ import * as Sentry from '@sentry/nextjs' -import {SENTRY_DSN} from 'common/hosting/constants' +import {IS_LOCAL, SENTRY_DSN} from 'common/hosting/constants' const IS_NATIVE = !!process.env.NEXT_PUBLIC_WEBVIEW @@ -11,6 +11,8 @@ Sentry.init({ // Skip tunneling in native app context dsn: SENTRY_DSN, + enabled: !IS_LOCAL, + // Add optional integrations for additional features integrations: IS_NATIVE ? [] : [Sentry.replayIntegration()], diff --git a/web/sentry.edge.config.ts b/web/sentry.edge.config.ts index 71c95488..3736d7cf 100644 --- a/web/sentry.edge.config.ts +++ b/web/sentry.edge.config.ts @@ -4,11 +4,13 @@ // https://docs.sentry.io/platforms/javascript/guides/nextjs/ import * as Sentry from '@sentry/nextjs' -import {SENTRY_DSN} from 'common/hosting/constants' +import {IS_LOCAL, SENTRY_DSN} from 'common/hosting/constants' Sentry.init({ dsn: SENTRY_DSN, + enabled: !IS_LOCAL, + // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control. tracesSampleRate: 0.1, diff --git a/web/sentry.server.config.ts b/web/sentry.server.config.ts index 7c581d9f..714c61c6 100644 --- a/web/sentry.server.config.ts +++ b/web/sentry.server.config.ts @@ -3,11 +3,13 @@ // https://docs.sentry.io/platforms/javascript/guides/nextjs/ import * as Sentry from '@sentry/nextjs' -import {SENTRY_DSN} from 'common/hosting/constants' +import {IS_LOCAL, SENTRY_DSN} from 'common/hosting/constants' Sentry.init({ dsn: SENTRY_DSN, + enabled: !IS_LOCAL, + // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control. tracesSampleRate: 0.1,