nuxt / nuxt/bridge

Process hangs if an error occurs during server-side rendering

Open
#351 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pending triage
Dominant language
TypeScript
Stars
285
Forks
33
Avg merge
22h 38m
Merged PRs (30d)
3

Description

Environment
  • Operating System: Windows_NT
  • Node Version: v16.13.1
  • Nuxt Version: 2.16.0-27358576.777a4b7f
  • Package Manager: npm@8.1.2
  • Builder: webpack
  • User Config: publicRuntimeConfig, modern, watch, buildModules, head, alias, router, css, loading, build, watchers, plugins, modules, axios, bridge
  • Runtime Modules: cookie-universal-nuxt@2.1.5, @nuxtjs/axios@5.13.6
  • Build Modules: @nuxtjs/tailwindcss@4.2.1, @nuxt/bridge@3.0.0-27545203.75e046f
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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction repository: run npm install, npm run dev, and issue a request using the invalid postcss.config setup. Trace the Nuxt Bridge server-side rendering error path and verify that an error returns a failed response instead of repeatedly rethrowing, hanging, or exhausting memory.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, nuxtjs, typescript, webpack
Domain
backend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.