From 648467d03ba394e9ffcb814dca64fdfa4e9fd0c0 Mon Sep 17 00:00:00 2001 From: 6figpsolseeker <6figpsolseeker@gmail.com> Date: Thu, 9 Apr 2026 16:28:02 -0400 Subject: [PATCH] fix(startup): use process.exit(1) for NODE_ENV validation, not throw NODE_ENV validation at startup used `throw new Error(...)` while every other env-var check in the same file (SUPABASE_URL, SUPABASE_KEY, API_AUTH_KEY, API_PORT, DB connectivity) uses `process.exit(1)` after logging. The throw produces an uncaught exception with a stack trace instead of the clean structured-log + exit pattern the rest of the startup sequence follows, confusing ops when NODE_ENV is misconfigured. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 597708e..0bc32f6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -246,7 +246,7 @@ if (!process.env.NODE_ENV || !validNodeEnvs.includes(process.env.NODE_ENV)) { nodeEnv: process.env.NODE_ENV ?? "(unset)", validOptions: validNodeEnvs.join(", ") }); - throw new Error(`NODE_ENV must be explicitly set. Got: ${process.env.NODE_ENV ?? "(unset)"}. Must be one of: ${validNodeEnvs.join(", ")}`); + process.exit(1); } const port = Number(process.env.API_PORT ?? 3001);