diff --git a/packages/worker/src/index.ts b/packages/worker/src/index.ts index 5a35b603..0706dcdd 100644 --- a/packages/worker/src/index.ts +++ b/packages/worker/src/index.ts @@ -35,7 +35,7 @@ const main = async () => { logger.info('Generating system env file...'); const envMap = await generateSystemEnvFile(); - if (envMap.get('ALLOW_ERROR_MONITORING') === 'true') { + if (envMap.get('ALLOW_ERROR_MONITORING') === 'true' && envMap.get('NODE_ENV') === 'production') { logger.info('Anonymous error monitoring is enabled, to disable it add "allowErrorMonitoring": false to your settings.json file'); setupSentry(); } diff --git a/packages/worker/src/lib/system/system.helpers.ts b/packages/worker/src/lib/system/system.helpers.ts index f390b70d..ed323251 100644 --- a/packages/worker/src/lib/system/system.helpers.ts +++ b/packages/worker/src/lib/system/system.helpers.ts @@ -36,6 +36,7 @@ type EnvKeys = | 'TIPI_GID' | 'TIPI_UID' | 'ALLOW_ERROR_MONITORING' + | 'NODE_ENV' // eslint-disable-next-line @typescript-eslint/ban-types | (string & {}); diff --git a/sentry.client.config.ts b/sentry.client.config.ts index e90b0886..f08f44f1 100644 --- a/sentry.client.config.ts +++ b/sentry.client.config.ts @@ -18,7 +18,7 @@ const getClientConfig = () => { return parsedSettings; }; -if (getClientConfig().allowErrorMonitoring) { +if (getClientConfig().allowErrorMonitoring && process.env.NODE_ENV === 'production') { Sentry.init({ environment: process.env.NODE_ENV, dsn: 'https://7a73d72f886948478b55621e7b92c3c7@o4504242900238336.ingest.sentry.io/4504826587971584', diff --git a/sentry.edge.config.ts b/sentry.edge.config.ts index 18dc3330..67436459 100644 --- a/sentry.edge.config.ts +++ b/sentry.edge.config.ts @@ -7,7 +7,7 @@ import * as Sentry from '@sentry/nextjs'; import { TipiConfig } from '@/server/core/TipiConfig'; import { cleanseErrorData } from '@runtipi/shared/src/helpers/error-helpers'; -if (TipiConfig.getConfig().allowErrorMonitoring) { +if (TipiConfig.getConfig().allowErrorMonitoring && TipiConfig.getConfig().NODE_ENV === 'production') { Sentry.init({ environment: TipiConfig.getConfig().NODE_ENV, dsn: 'https://7a73d72f886948478b55621e7b92c3c7@o4504242900238336.ingest.sentry.io/4504826587971584', diff --git a/sentry.server.config.ts b/sentry.server.config.ts index 91046954..a939ff57 100644 --- a/sentry.server.config.ts +++ b/sentry.server.config.ts @@ -6,7 +6,7 @@ import * as Sentry from '@sentry/nextjs'; import { TipiConfig } from '@/server/core/TipiConfig'; import { cleanseErrorData } from '@runtipi/shared/src/helpers/error-helpers'; -if (TipiConfig.getConfig().allowErrorMonitoring) { +if (TipiConfig.getConfig().allowErrorMonitoring && TipiConfig.getConfig().NODE_ENV === 'production') { Sentry.init({ environment: TipiConfig.getConfig().NODE_ENV, dsn: 'https://7a73d72f886948478b55621e7b92c3c7@o4504242900238336.ingest.sentry.io/4504826587971584',