From 05e5692ce63f8337ad7f756950a52b2d201085d9 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 1 Feb 2026 22:16:43 +0000 Subject: [PATCH] fix: Disable Sentry in development mode - Add NODE_ENV check to server and edge configs to ensure Sentry is only enabled when both NODE_ENV and VERCEL_ENV are "production" - Change client hostname check from includes() to exact match to prevent errors from subdomains or similar domains https://claude.ai/code/session_013jBTzFjbJQFyfsDM5pT4t1 --- packages/web/instrumentation-client.ts | 3 ++- packages/web/sentry.edge.config.ts | 5 ++++- packages/web/sentry.server.config.ts | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/web/instrumentation-client.ts b/packages/web/instrumentation-client.ts index f1a91f71..e146d5b8 100644 --- a/packages/web/instrumentation-client.ts +++ b/packages/web/instrumentation-client.ts @@ -5,9 +5,10 @@ import * as Sentry from "@sentry/nextjs"; // Only enable Sentry on boardsesh.com to avoid polluting error tracking +// Check hostname to ensure we don't send errors from localhost or preview deployments const isProductionDomain = typeof window !== "undefined" && - window.location.hostname.includes("boardsesh.com"); + window.location.hostname === "boardsesh.com"; Sentry.init({ dsn: "https://f55e6626faf787ae5291ad75b010ea14@o4510644927660032.ingest.us.sentry.io/4510644930150400", diff --git a/packages/web/sentry.edge.config.ts b/packages/web/sentry.edge.config.ts index 834bf76b..67b6de3f 100644 --- a/packages/web/sentry.edge.config.ts +++ b/packages/web/sentry.edge.config.ts @@ -6,7 +6,10 @@ import * as Sentry from "@sentry/nextjs"; // Only enable Sentry on production deployments to avoid polluting error tracking -const isProductionDomain = process.env.VERCEL_ENV === "production"; +// Check both NODE_ENV and VERCEL_ENV to ensure we don't send errors from local dev or preview deployments +const isProductionDomain = + process.env.NODE_ENV === "production" && + process.env.VERCEL_ENV === "production"; Sentry.init({ dsn: "https://f55e6626faf787ae5291ad75b010ea14@o4510644927660032.ingest.us.sentry.io/4510644930150400", diff --git a/packages/web/sentry.server.config.ts b/packages/web/sentry.server.config.ts index a8a3080e..eb858a0b 100644 --- a/packages/web/sentry.server.config.ts +++ b/packages/web/sentry.server.config.ts @@ -5,7 +5,10 @@ import * as Sentry from "@sentry/nextjs"; // Only enable Sentry on production deployments to avoid polluting error tracking -const isProductionDomain = process.env.VERCEL_ENV === "production"; +// Check both NODE_ENV and VERCEL_ENV to ensure we don't send errors from local dev or preview deployments +const isProductionDomain = + process.env.NODE_ENV === "production" && + process.env.VERCEL_ENV === "production"; Sentry.init({ dsn: "https://f55e6626faf787ae5291ad75b010ea14@o4510644927660032.ingest.us.sentry.io/4510644930150400",