From eba3c0631885c2b5cde77a0695987e0c12c3474c Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Tue, 19 Nov 2024 17:00:08 -0700 Subject: [PATCH] fix: try simplifying sentry dsn lookup --- web/src/lib/sentry.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/web/src/lib/sentry.ts b/web/src/lib/sentry.ts index 096d8f3..a0f0099 100644 --- a/web/src/lib/sentry.ts +++ b/web/src/lib/sentry.ts @@ -3,9 +3,10 @@ import * as Sentry from '@sentry/react' let dsn = '' let environment = 'development' -console.log({ env: process.env }) +// HACK: I think this helps the build rewrite find the env var +const SENTRY_DSN = process.env.SENTRY_DSN -if (typeof process === 'undefined' || !process.env?.SENTRY_DSN) { +if (typeof process === 'undefined' || !SENTRY_DSN) { console.error( 'Missing SENTRY_DSN environment variable. Did you forget to add it to ' + 'your redwood.toml file in `includeEnvironmentVariables`?' @@ -19,7 +20,7 @@ if (typeof process === 'undefined' || !process.env?.SENTRY_DSN) { `) console.error('Sentry is disabled for now') } else { - dsn = process.env.SENTRY_DSN + dsn = SENTRY_DSN environment = process.env.NODE_ENV }