From 3a09efe9ac28525e314b0638d77d42503e8219fe Mon Sep 17 00:00:00 2001 From: Matt Kane Date: Thu, 29 Jul 2021 11:11:31 +0100 Subject: [PATCH] fix: exit on unhandled promsie rejection --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index 228bd4330a..e42b977611 100644 --- a/index.js +++ b/index.js @@ -67,6 +67,10 @@ You can do this by running: "npm install -g netlify-cli@latest" or "yarn global ) } await restoreCache({ cache: utils.cache, distDir: nextConfig.distDir, nextRoot }) + + // Exit the build process on unhandled promise rejection. This is the default in Node 15+, but earlier versions just warn. + // This causes problems as it doesn't then know the build has failed until we try to copy the assets. + process.env.NODE_OPTIONS = [process.env.NODE_OPTIONS, '--unhandled-rejections=strict'].filter(Boolean).join(' ') }, async onBuild({ netlifyConfig,