vercel: Next.js dev server gets stuck after a while, requests just spin

Moved from zeit/next.js#10061

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.

How to reproduce

The original reporter provided this:

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.

Run now dev Work on the app, making changes to files, saving, and watching them hot reload in the browser 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.

I encounter the same issue on a different private repo. Changing even css in styled-jsx can block the server. Since ctrl+c is so slow to answer I ctrl+z then kill -9 %1 then restart now dev

Expected behavior

Continuing to make changes should keep working and trigger refreshes in the browser.

System information

original reporter’s

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

OS: Ubuntu 19.10 Browser: both chrome and firefox trigger the issue Version of Next.js : 9.1.6, 9.1.7,9.2.0 Version of Now cli : 16.7.3

the problem has started since we upgraded to next.js 9

Additional context

The issue disappears if we run next dev directly.

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 14
  • Comments: 21 (5 by maintainers)

Most upvoted comments

Yep, I’m getting this too. Usually happens when I break something. Cant ctrl C neither.

Same issue here, sometimes I try to manually reload and get stuck forever.

I’m seeing this with both chrome and Firefox on linux

Le dim. 9 févr. 2020 à 19:36, Pier Bover notifications@github.com a écrit :

I’m seeing this in Firefox on macOS with an Eleventy + API project. Not on Chromium-based browsers though.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zeit/now/issues/3612?email_source=notifications&email_token=AAAFTQ6Z3AUZMALGR4PDMHLRCBEMDA5CNFSM4KIF2W72YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELGUK2Q#issuecomment-583877994, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAFTQ3633O7WLBRA3YRRO3RCBEMDANCNFSM4KIF2W7Q .

We’ve been experiencing this for over a year. I assumed it was just some quirk of our specific setup (we have a custom server with TypeScript) but it’s interesting to hear others are having this issue.

Similar symptoms for us - after about an hour, the dev server just stops responding and I have to Ctrl+C and then restart and all is well again.

  • Next 9.4.2
  • CSS Modules (no styled-jsx)
  • A custom server using express
  • TypeScript 3.8.3
  • Plugins: next-offline, next-images, @zeit/next-source-maps

@mcsdevv Ok so I just realised because of your post that I actually don’t need now dev anymore and can use next dev. At the start I wasn’t using nextjs yet, so relied on now to start my serverless functions. But I recently migrated to next and forgot that next dev also runs the serverless functions in that case. So thanks for that!

I think my experience lines up with yours. I was able to adjust my app enough to run correctly outside now dev and just run npx next dev, and while I haven’t had a lot of time to test it, I haven’t seen the issue yet.

@jeantil does your project use TypeScript or just JavaScript? wondering if it has anything to do with it.