bridge icon indicating copy to clipboard operation
bridge copied to clipboard

Process hangs if an error occurs during server-side rendering

Open klausXR opened this issue 3 years ago • 0 comments

Environment

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

  1. Create a nuxt 2 app as described here https://nuxtjs.org/docs/get-started/installation/
  2. 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

image

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

klausXR avatar May 23 '22 09:05 klausXR