From 86ceb2b610a2a9a15fedc70b5690017e41fee5fe Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Mon, 14 Dec 2020 20:45:12 -0500 Subject: [PATCH] server: Exit on unhandled Promise rejection --- src/node/server.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/node/server.js b/src/node/server.js index 3e3b25d21..d14fca92d 100755 --- a/src/node/server.js +++ b/src/node/server.js @@ -77,6 +77,9 @@ exports.start = async () => { } process.on('uncaughtException', exports.exit); + // As of v14, Node.js does not exit when there is an unhandled Promise rejection. Convert an + // unhandled rejection into an uncaught exception, which does cause Node.js to exit. + process.on('unhandledRejection', (err) => { throw err; }); /* * Connect graceful shutdown with sigint and uncaught exception