diff --git a/apps/as/instrumentation-client.ts b/apps/as/instrumentation-client.ts index 07509aaa4..93548aca2 100644 --- a/apps/as/instrumentation-client.ts +++ b/apps/as/instrumentation-client.ts @@ -2,7 +2,13 @@ import * as Sentry from "@sentry/nextjs"; export const onRouterTransitionStart = Sentry.captureRouterTransitionStart; +const isSentryEnabled = + process.env.NEXT_PUBLIC_SENTRY_ENABLED === "true" && + process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "dev" && + process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "prd"; + Sentry.init({ + enabled: isSentryEnabled, dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT ?? "local", tracesSampleRate: 1.0, diff --git a/apps/as/next.config.ts b/apps/as/next.config.ts index ff77b9a36..be9b410eb 100644 --- a/apps/as/next.config.ts +++ b/apps/as/next.config.ts @@ -8,12 +8,18 @@ const nextConfig: NextConfig = { outputFileTracingRoot: path.join(__dirname, "../../"), }; +const isSentryEnabled = + process.env.NEXT_PUBLIC_SENTRY_ENABLED === "true" && + process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "dev" && + process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "prd"; + export default withSentryConfig(nextConfig, { org: process.env.SENTRY_ORG, project: process.env.SENTRY_PROJECT, silent: true, widenClientFileUpload: true, tunnelRoute: "/monitoring", + disable: !isSentryEnabled, webpack: { treeshake: { removeDebugLogging: process.env.NEXT_PUBLIC_SENTRY_DEBUG === "true" ? false : true, diff --git a/apps/as/sentry.edge.config.ts b/apps/as/sentry.edge.config.ts index 436630178..f1064d70b 100644 --- a/apps/as/sentry.edge.config.ts +++ b/apps/as/sentry.edge.config.ts @@ -1,6 +1,12 @@ import * as Sentry from "@sentry/nextjs"; +const isSentryEnabled = + process.env.NEXT_PUBLIC_SENTRY_ENABLED === "true" && + process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "dev" && + process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "prd"; + Sentry.init({ + enabled: isSentryEnabled, dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT ?? "local", tracesSampleRate: 1.0, diff --git a/apps/as/sentry.server.config.ts b/apps/as/sentry.server.config.ts index 436630178..f1064d70b 100644 --- a/apps/as/sentry.server.config.ts +++ b/apps/as/sentry.server.config.ts @@ -1,6 +1,12 @@ import * as Sentry from "@sentry/nextjs"; +const isSentryEnabled = + process.env.NEXT_PUBLIC_SENTRY_ENABLED === "true" && + process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "dev" && + process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "prd"; + Sentry.init({ + enabled: isSentryEnabled, dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT ?? "local", tracesSampleRate: 1.0, diff --git a/apps/cs/instrumentation-client.ts b/apps/cs/instrumentation-client.ts index 07509aaa4..93548aca2 100644 --- a/apps/cs/instrumentation-client.ts +++ b/apps/cs/instrumentation-client.ts @@ -2,7 +2,13 @@ import * as Sentry from "@sentry/nextjs"; export const onRouterTransitionStart = Sentry.captureRouterTransitionStart; +const isSentryEnabled = + process.env.NEXT_PUBLIC_SENTRY_ENABLED === "true" && + process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "dev" && + process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "prd"; + Sentry.init({ + enabled: isSentryEnabled, dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT ?? "local", tracesSampleRate: 1.0, diff --git a/apps/cs/next.config.ts b/apps/cs/next.config.ts index 11d8237c7..1fdc9639b 100644 --- a/apps/cs/next.config.ts +++ b/apps/cs/next.config.ts @@ -59,12 +59,18 @@ const nextConfig: NextConfig = { }, }; +const isSentryEnabled = + process.env.NEXT_PUBLIC_SENTRY_ENABLED === "true" && + process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "dev" && + process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "prd"; + export default withSentryConfig(nextConfig, { org: process.env.SENTRY_ORG, project: process.env.SENTRY_PROJECT, silent: true, widenClientFileUpload: true, tunnelRoute: "/monitoring", + disable: !isSentryEnabled, webpack: { treeshake: { removeDebugLogging: process.env.NEXT_PUBLIC_SENTRY_DEBUG === "true" ? false : true, diff --git a/apps/cs/sentry.edge.config.ts b/apps/cs/sentry.edge.config.ts index 436630178..f1064d70b 100644 --- a/apps/cs/sentry.edge.config.ts +++ b/apps/cs/sentry.edge.config.ts @@ -1,6 +1,12 @@ import * as Sentry from "@sentry/nextjs"; +const isSentryEnabled = + process.env.NEXT_PUBLIC_SENTRY_ENABLED === "true" && + process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "dev" && + process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "prd"; + Sentry.init({ + enabled: isSentryEnabled, dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT ?? "local", tracesSampleRate: 1.0, diff --git a/apps/cs/sentry.server.config.ts b/apps/cs/sentry.server.config.ts index 436630178..f1064d70b 100644 --- a/apps/cs/sentry.server.config.ts +++ b/apps/cs/sentry.server.config.ts @@ -1,6 +1,12 @@ import * as Sentry from "@sentry/nextjs"; +const isSentryEnabled = + process.env.NEXT_PUBLIC_SENTRY_ENABLED === "true" && + process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "dev" && + process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "prd"; + Sentry.init({ + enabled: isSentryEnabled, dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT ?? "local", tracesSampleRate: 1.0,