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.

Rendering /_error mutates the status code for no reason

See original GitHub issue

Verify canary release

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

Provide environment information

Can reproduce on any environment

Describe the Bug

When using Next with a custom server and rendering /_error, Next changes the res.status to 404 before rendering the page, it’s really odd.

It’s really easy to reproduce https://replit.com/@replitfaris/NextChangeStatusCode, you can fork this and run it yourself

Looks like there’s a report of this behavior going back to 2017 https://github.com/vercel/next.js/issues/2866

Expected Behavior

Maintain res.status

Link to reproduction

https://replit.com/@replitfaris/NextChangeStatusCode

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
balazsorban44commented, Aug 3, 2022

I can do it later, you can also open a PR, here is the file that needs to be edited: https://github.com/vercel/next.js/edit/canary/docs/advanced-features/custom-error-page.md

0reactions
github-actions[bot]commented, Sep 3, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting errors 400 and 404 intermittently - Render community
Hi, I'm running a web service through Render that I use as my API for my webapp. (The name of my web service...
Read more >
HTTP response status codes - MDN Web Docs - Mozilla
This code indicates that the server has received and is processing the request, but no response is available yet.
Read more >
Using WebSecurity.ignoring results in 401 status code when ...
If an error is thrown when handling a request to an endpoint that does not have the Spring Security filter chain applied to...
Read more >
How to Fix the HTTP 304 Not Modified Status Code - Kinsta®
The HTTP 304 not modified status code indicates a communication problem between a user's browser and a website's server.
Read more >
Handling operation errors - Apollo GraphQL Docs
Apollo Server responds with a 200 status code if resolver errors occurred but the ... and any returned data is cached and rendered...
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