From 09d2039cf011931808a29e9b68ee98d059cbab74 Mon Sep 17 00:00:00 2001 From: MOHAN Date: Wed, 26 Aug 2026 23:58:46 +0530 Subject: [PATCH] Don't require SENTRY_DSN to boot in production MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A missing Sentry DSN meant "no error tracking configured yet," not "the API should refuse to start" — but env validation treated it as the latter, hard-failing startup in production if it wasn't set. Sentry initialization was already conditional on SENTRY_DSN being present (src/main.ts), so this only affects the boot-time validation gate, not whether Sentry actually turns on when configured. --- src/config/env.validation.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/config/env.validation.ts b/src/config/env.validation.ts index 467b534..c5bad05 100644 --- a/src/config/env.validation.ts +++ b/src/config/env.validation.ts @@ -59,11 +59,10 @@ export const envValidationSchema = Joi.object({ AUTO_SYNC_LOOKBACK_DAYS: Joi.number().integer().min(1).max(365).default(7), AUTO_SYNC_MAX_USERS_PER_RUN: Joi.number().integer().min(1).max(500).default(25), - SENTRY_DSN: Joi.when("NODE_ENV", { - is: "production", - then: Joi.string().uri().required(), - otherwise: Joi.string().uri().optional().allow(""), - }), + // Strongly recommended in production for error visibility, but not + // required to boot: a missing Sentry DSN should mean "no error tracking + // yet", not "the whole API refuses to start." + SENTRY_DSN: Joi.string().uri().optional().allow(""), SENTRY_TRACES_SAMPLE_RATE: Joi.number().min(0).max(1).default(0), GOOGLE_CLIENT_ID: Joi.string().optional().allow(""),