cli icon indicating copy to clipboard operation
cli copied to clipboard

`nuxi dev` causes requests to stay "Pending"

Open hendrikheil opened this issue 1 year ago • 4 comments

We've just discovered some behavior that causes our projects to completely stop working after the first request.

To give some context, we currently have our projects on nuxt v3.6.5. After updating to latest nuxt (currently 3.8.0), our apps start to have around 10% of their requests stuck in "Pending" when checking out the network tab in Chrome DevTools.

We've been able to isolate the issue to 3.7.0, as thats the version when this starts happening. More specifically, we traced it to nuxi v3.7.0. Whenever we override nuxt's dependency on nuxi to v3.6.5, all works just like expected.

We're seeing this irrelevant of OS (we tested MacOS and Linux) and Node version (we tested 18 and 20).

In our case, something causes every date-fns and lodash-es function to be imported as a single request, meaning we end up making 1.2k requests to load our SPA. The first request usually works just fine, however any requests after are partially stuck in "Pending", some seem to resolve after a delay of 30s. As soon as there are requests that get into the Pending state, we don't really leave the spa-loading-template content anymore and can't do anything with the apps.

For now the workaround is to pin nuxi, but that doesn't seem like a good solution. We could also spend more time to figure out why we there are so many requests in the first place, but even then 1200 local requests on a machine don't seem like they should be a bottle neck at all.

Before we dive super deep into this, is there anybody that has experienced this too? We'll try to provide a reproduction repo of course.

Might be related to https://github.com/nuxt/cli/issues/209

hendrikheil avatar Nov 03 '23 15:11 hendrikheil

Just confirmed this, using --no-fork completely resolves the issue for us. We don't need to pin anymore, but maybe a reproduction from our case is still a good idea? @pi0

hendrikheil avatar Nov 03 '23 15:11 hendrikheil

We are aware of some possible scenarios that this might happen with forked dev server and already plan to make some attempts fixing it (using socket file).

But any reproduction or environment info (os, using ipv6 or not, node version, using any specific listener options or package manager, etc) would be super helpful since i still have no stable reproduction.

Also feel free to DM me in discord (pi0) if you like to directly show me your project.

pi0 avatar Nov 03 '23 17:11 pi0

Has there been any updates about this issue? I have this problem too. If it is needed I could provide some information about my environment or specific options I have used? I have noticed however that this issue is also there on a brand new project using npx nuxi@latest init <project-name>

Ashlayyy avatar Apr 23 '24 20:04 Ashlayyy

I have the same issue on Windows 11 OS using nuxt 3.11.2. SSR + https dev server with self-signed certificate. Only switching to 127.0.0.1 instead of localhost can help but in my case I can`t switch localhost for project due to infrastructure reasons --no-fork flag also helps but maybe there is another way to fix in a civilized way?

Talla2XLC avatar May 24 '24 08:05 Talla2XLC