From d2030e826b2c0cdfd6c9f7bde4bb69aa24922ceb Mon Sep 17 00:00:00 2001 From: Konstantin Wohlwend Date: Tue, 12 May 2026 13:14:12 -0700 Subject: [PATCH] Unhandled promise rejections no longer kill the whole server if not in development --- apps/backend/src/polyfills.tsx | 2 +- apps/dashboard/src/polyfills.tsx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/backend/src/polyfills.tsx b/apps/backend/src/polyfills.tsx index 9215616b3..510535033 100644 --- a/apps/backend/src/polyfills.tsx +++ b/apps/backend/src/polyfills.tsx @@ -50,8 +50,8 @@ export function ensurePolyfilled() { captureError("unhandled-promise-rejection", reason); if (getNodeEnvironment() === "development") { console.error("\x1b[41mUnhandled promise rejection. Some production environments (particularly Vercel) will kill the server in this case, so the server will now exit. Please use the `ignoreUnhandledRejection` function to signal that you've handled the error.\x1b[0m", reason); + (globalThis as any).process.exit(1); } - (globalThis as any).process.exit(1); }); } } diff --git a/apps/dashboard/src/polyfills.tsx b/apps/dashboard/src/polyfills.tsx index 8e4459d92..f62bdb3c3 100644 --- a/apps/dashboard/src/polyfills.tsx +++ b/apps/dashboard/src/polyfills.tsx @@ -44,9 +44,9 @@ export function ensurePolyfilled() { captureError("unhandled-promise-rejection", reason); if (getNodeEnvironment() === "development") { console.error("Unhandled promise rejection. Some production environments (particularly Vercel) will kill the server in this case, so the server will now exit. Please use the `ignoreUnhandledRejection` function to signal that you've handled the error.", reason); - } - if ((globalThis.process as any).exit) { - globalThis.process.exit(1); + if ((globalThis.process as any).exit) { + globalThis.process.exit(1); + } } }); }