This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Next.js dev server gets stuck after a while, requests just spin #10061
Comments
Might help to eliminate if it's |
Hi, I have the exact same issue, after running |
Same issue here |
Likewise, same issue - seems intermittent and not tied to any particular change. It will work for a while, and then hang on the next change. Rerunning
(FWIW I'm not using TS, just plain old JS) |
I've figured out a way to reproduce this a bit, will try to solve the issue. |
This seems to happen on a project I work on as well. Usually starts taking a lot of memory and CPU as well. |
Having trouble consistently reproducing it to investigate, if you run into it please provide steps to reproduce or a repository, I'd love to investigate further but I could only investigate it about 5 minutes while trying for 2 hours. |
Hello I am facing the same problem too! My dependencies are as follows: Just for comparison, Gatsby's start script works extremely well on my computer (not sure if this is worth anything) Should I downgrade from 9.3.6 to a stable version? (This is my third month self learning coding so if I sound dumb I apologise) |
Hi, I have the exact same issue, even in the clean Next.js starter app ( To ReproduceRun System information
SolutionI am not sure, but it seems to work in my case. When I start server with different port (not the default |
I ran into this problem as well, and it was caused by an old cached service worker. I cleaned the cache completely (under dev tools -> application in Chrome) and the problem was fixed. Not sure if your problem is due to the same cause. |
I've been dealing with this issue for a long time. Latest nextjs, fresh install of macOS 10.15.4, it happens all the time, it's a PITA. The only thing that worked for me was @neupauer's solution, running dev server on another port (in my case 🎉 |
@pablopunk have you tried cleaning out the cached service worker? That cache will be port-specific, so by changing the port you're working around the problem. Curious to see if this is the root cause for others or just for me. |
@eandre I have and I think the issue came back eventually. Anyway, this is an issue on next.js and should be solved |
Of course it should be solved! I'm just trying to help find the root cause. 🙂 |
I'm having this issue with 'Vue' as well; so I wonder if it is not a next.js issue but a vercel dev issue |
@HunderlineK This also applies to |
Hi :) Just to summarize there was/are 3 well-known issues which might be shared:
Still, as there is no proper way to reproduce these were just some clues we found. It might be also a generic chrome bug. |
webpack-hot-middleware uses up one of the 6 connections via EventSource, and when all are used up it results in the browser being unable to establish more connections and therefore an infinite loading spinner: webpack-contrib/webpack-hot-middleware#298 Maybe there's a rogue service worker that hogs up more and more connections over time and never releases them. Just guessing though. |
@jgillich EvenSource is probably a cause. For nuxt there is also an additional SSE handler for loading-screen/indicator. (next release will use new port but it also brings its own problems...). Just to give some more context, previously we were using Websockets and the issue was less visible... |
@pi0 I have this issue on FF as well. In my case at least, once it happens, it just fails across all of the other browsers that I have i.e. Chrome, Edge and Safari. I also know this only happens once there is a change in the source code. I have also had this problem with using 'vercel dev' only for the API; i.e. I had my dev server separately setup for serving the front end and then vercel for the API and ended up in a situation where front end was working but API was stuck 🤷♂️ |
@HunderlineK I also experience that but I think it is another issue... Hope we can finally find root-cause(s) together :) |
We are facing the same issue... Everytime we have a new release, our platform cannot load any new pages on the client machines until they refresh their cache. As we are a B2C company, its hard to notify and teach the users about this... |
This sounds unrelated to the issue @mjm reported which only manifests in the development server, which I doubt you're running in production. Can you create a discussion on https://github.com/vercel/next.js/discussions with clear and concise reproduction steps. |
Ah, thanks, will do! |
Running version: 9.3.5 One way this seems to continually happen is if I delete a file that is imported somewhere in my app, without removing the import statement. Doesn't seem to happen every time but that is the most common scenario where it has occurred. After that it usually gets stuck in the compiling stage. I'm running the vercel dev command by the way. |
FWIW, I'm experiencing this on zeit 9.4 with a customer server on both Chromium and Safari. I cleared my cache and also tried on incognito in both browsers. Ran Edit: Found it was the |
Version: 9.5.2 Same here it's really annoying 😒 |
+1 |
It's 2023 and I'm still getting this error.
OS: Windows 11 x64 I already tried to change the next port in the package.json scripts to 1234 or 8888 or 5000 and so on but nothing changes. |
This worked for me! Thanks! |
Manually disabled prefetch in whole application |
@Stroik for that case make sure you're using next@canary currently (or 13.3.0 which is going out right now). |
One possible reason for freezing is that Next.js is trying to download a font but the server is throttling your requests. It might be that you are hitting a limit of the font provider. I was using Inter font from Google. The issue was gone when I either
Could we define timeout via env var or display a better error text if font fetching takes a long time? |
Fixed it by deleting .next folder and rebuilding it using 'npm run build". I would also recommend deleting node_modules, and reinstall with "npm i" |
Upgrading from node 14 to node 16.6.0 solved the problem for me. This only started happening after the new nextjs image component from nextjs 13 was introduced to the project |
Deleting and rebuilding .next and node_modules made no difference for me. Disabling my home VPN did enable localhost to load. Suggests external dependency being blocked. I have a fresh 'create-next-app' install, no other dependencies added. |
I came across the same issue. In my case, when I checked the 'network' in the console I noticed that the throttling was set to 'slow 3G'. I did use throttling some time ago and reverted it to 'no throttling' but for some reason it throttled on this occasion. Hence it seemed it was stuck in the loading state. |
Same issue, same resolution.
|
I cant really upgrade to node v-18 cause some dependecies in my project, but what worked for me is downgrading node to v16.15 from v16.44. i did exact this: "next": "12.3.1", Mac Air M1 2020, Ventura 13.1 |
I had a similar problem, for me it was because I accidentally had created an asynchronous client component (switched from a server component and forgot to make it synchronous.) I didn’t get any error messages, just a loading page so it was a bit tricky to debug. |
On my side, it was a leak from my postgreSQL database clients pool, so when I would be out of clients from the pool, the app would become unresponsive. This was hard to track, since most of the next app is cached (especially route endpoints from Link components) so only my API requests would never succeed. |
But in my case there are 3 instances? (2 nodes and 1 from Google) Is it supposed to be like this? |
Faced same issue but it started working fine as soon as i upgraded the node version 16.8 to latest. |
Thank you so much, was dealing with this bug for a weak. I think Next js should include a warning/error of some sort and close this issue. |
i was having similar issue and i must say upgrading my node version to 18 didn't work, i even cleared cache still nothing what worked for me was renaming that component that was not responding to changes. My issue was coming from my signup component (i created a componet outside and passed it in my page.js `import React from 'react'; const page = () => { ); }; export default page; what i did was to change the name of the component (the Signin component was formally name Login) to the same name that the folder that acts as the route is bearing (which is Signin) |
Changing dev port from 3000 to 3001 resolved my issue, so you should try as well |
The point about Typescript, you are correct! |
@SahilAggarwalHeliverse you are on point. seems like ts is the issue here. removed custom types and it started working fine. |
same problem. Next compiles but no response is send to the browser. I tried deleting .next node_modules, changing the port, updating node but didn't help. Updating next from 13.4.19 to 13.5.4 solved the issue |
Thanks so much for this. This finally worked. This is the worst kind of error you want to have. There's no clue on the console or error thrown |
One page stuck. It's using <Script> to load a canvas js library. Loads fine for a while, then stops and no console logs showing at all...and no error logs. Changed <Script> method from onLoad to onReady and that seems to work. Why server invokes onLoad only for a while I don't know. Maybe helps someone. Update: Scratch that. It was up longer but eventually stopped rendering this page anyway.
|
👋 Hey folks. Wanted to summarize this issue. Some of you all are experiencing an issue where the Next.js development server gets stuck after a period of time, causing requests to fail or time out. It's tricky because the problem seems to occur intermittently and isn't clearly tied to any particular change or action. There's been reports across different operating systems and versions of Next.js. Solutions / workarounds suggested throughout this issue:
Note that not everyone has been able to resolve the issue, and there isn't a one-size-fits-all solution that works in all cases. I encourage everyone to keep sharing their experiences and any potential fixes they come across. And if you are still seeing an issue and can consistently reproduce, please post that reproduction so we can investigate. Thanks! |
I've had this issue multiple times, usually solution 5 works for me. Here's some solutions that worked for me on the occasions when solution 5 didn't:
|
what about having same issue on production mode too? |
Hi everyone! I will be moving this issue to our We still encourage folks to file bugs outside of this thread detailing the exact issue, with a Happy 2024! |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Bug report
Describe the bug
When I run my Next.js app with
now dev
, after a while (on the order of minutes, definitely less than an hour) my requests to it will stop working.To Reproduce
I'm not sure how to isolate this one. It happens all the time with this project https://github.com/mjm/courier-js but it's not an easy thing to get running for reproduction.
now dev
When I give up, I can hit Ctrl-C to try to kill the server, but if it's in this state, it can take a minute or two to actually get the message and quit.
Expected behavior
Continuing to make changes should keep working and trigger refreshes in the browser.
System information
Additional context
I feel like this could be TypeScript related, but I don't have any evidence. I'm on the latest release for that as well. I'm happy to try things that might help understand what's going on. The only thing I've seen in the log from
now dev
(ornext dev
I guess) is that it seems like when it gets in this state, it will stack up two or three "compiling ..." messages when there would otherwise be just one.The text was updated successfully, but these errors were encountered: