Next.js dev server gets stuck after a while, requests just spin
Problem
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. 1. Run `now dev` 2. Work on the app, making changes to files, saving, and watching them hot reload in the browser 3. Eventually, one of these changes will try to reload and will get stuck. The on-page indicator for a page compiling will be there and keep spinning continuously. Trying to refresh the page just causes the browser to try to load the page until it times out. 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 - OS: macOS Catalina, though I think this happened before upgrading too - Browser (if applies): I've seen in both Chrome and Safari - Version of Next.js: 9.1.7, has happened in earlier versions of Next 9 as well - Version of Now CLI: 16.7.3 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
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Next.js dev server gets stuck after a while, requests just spin
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.
Trust Score
7 verifications
- 1
I ran into this problem as well, and it was caused by an old cached service work
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.
Validation
Resolved in vercel/next.js GitHub issue #10061. Community reactions: 42 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep