question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[next.config.js rewrites] Error: socket hang up

See original GitHub issue

Verify canary release

  • I verified that the issue exists in Next.js canary release

Provide environment information

    Operating System:
      Platform: linux
      Arch: x64
      Version: #1 SMP Wed Oct 28 23:40:43 UTC 2020
    Binaries:
      Node: 16.13.1
      npm: 8.1.2
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 12.1.5
      react: 17.0.2
      react-dom: 17.0.2

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

When using rewrites it’s impossible to make a request to API endpoint that takes more than 30 seconds to respond. After 31 second Next just throws the error Server Error Error: socket hang up which makes it impossible to use with any responding APIs.

Expected Behavior

There should be a soft timeout which would not throw after 30 seconds but should proceed waiting for the response and only show a warning. Or provide additional option to set custom timeouts.

To Reproduce

Create a rewrite rule to the endpoint which responds more than 30 seconds.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:13
  • Comments:45 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
reuixiycommented, Jun 23, 2022

Same issue here!

6reactions
mdaverdecommented, Jul 27, 2022

To add some additional details, this is happening to me sporadically without any rewrites off latest (12.2.3). I can try canary later today. It’s sporadic, but I’m more likely to see it right after server start.

And it is happening to me in production. I saw it some Sentry logs this morning. Hope some of this helps

Read more comments on GitHub >

github_iconTop Results From Across the Web

NodeJS - What does "socket hang up" actually mean?
It means that socket does not send connection end event within the timeout period. If you are getting the request for cheerio via...
Read more >
Hang in There! (A solution to socket hang up) - Medium
So, I set about playing with the settings to varying degrees of nothing. It was frustrating, but undeterred I moved on to the...
Read more >
Problems parameters dynamic routes : r/nextjs - Reddit
Hello community I have problems passing my dynamic path parameters to my component, I am using getStaticPaths and getStaticProps, ...
Read more >
Errors – Vercel Docs
A list of errors provided by Vercel CLI or the REST API, with details on how they ... Next.js automatically handles the other...
Read more >
Kibana Server is Not Yet Ready - Elastic Discuss
I have trouble setting up my ELK stack as I have faced an issue ... basePath: "" # Specifies whether Kibana should rewrite...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found