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",