From de504836a4fb57912e5c4c4f38920fcda1aa2b58 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sun, 14 Apr 2024 11:02:29 +0300 Subject: [PATCH] Prevent app from crashing on unhandled rejection Context: https://github.com/remix-run/remix/issues/9178#issuecomment-2032102431 --- app/entry.server.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/entry.server.tsx b/app/entry.server.tsx index 4e2b0fea5..f77bea515 100644 --- a/app/entry.server.tsx +++ b/app/entry.server.tsx @@ -178,3 +178,7 @@ if (!global.appStartSignal && process.env.NODE_ENV === "production") { updatePatreonData().catch((err) => console.error(err)), ); } + +process.on("unhandledRejection", (reason: string, p: Promise) => { + console.error("Unhandled Rejection at:", p, "reason:", reason); +});