Process hangs if an error occurs during server-side rendering
Environment
- Operating System:
Windows_NT - Node Version:
v16.13.1 - Nuxt Version:
2.16.0-27358576.777a4b7f - Package Manager:
[email protected] - Builder:
webpack - User Config:
publicRuntimeConfig,modern,watch,buildModules,head,alias,router,css,loading,build,watchers,plugins,modules,axios,bridge - Runtime Modules:
[email protected],@nuxtjs/[email protected] - Build Modules:
@nuxtjs/[email protected],@nuxt/[email protected]
Reproduction
https://github.com/klausXR/nuxt-ssr-reproduction
To reproduce the bug, run npm install and npm run dev and issue a request, the process should hang and start consuming more memory
How the repository was created
- Create a nuxt 2 app as described here https://nuxtjs.org/docs/get-started/installation/
- Install bridge packages and modify run scripts as described here https://v3.nuxtjs.org/bridge/overview
For the reproduction of the bug, I have added the tailwindcss module and a postcss.config file. The config file causes something to throw an error, which I guess is not handled properly because it causes the process to hang
Describe the bug
I'm in the process of migrating an existing Nuxt 2 app to Nuxt Bridge.
When I run the development build ( set PORT=8040&& nuxi dev ), if an error occurs during server-side rendering, the process hangs in what appears to be an infinite loop of rethrowing the same error.
If nothing goes wrong server-side, it does work.
Additional context
Here's a screenshot from vscode's debugger

no matter how many times I press resume here, it will not deliver a failed response to the client. Instead, the process hangs indefinitely and when it reaches the 4gb memory limit, it crashes.
This happened multiple times because of migrating packages from CJS->ESM. When a package had the incorrect format, I always got the same issue.
This particular problem visible on the image is due to an invalid postcss.config file ( it was easy to reproduce ) but it happens for any error, as I mentioned.
I tried with a minimal nuxt.config file and disabling plugins/middleware/modules, but nothing fixes it
Bridge version - npm:@nuxt/bridge-edge@^3.0.0-27545203.75e046f
Logs
No response