-
Notifications
You must be signed in to change notification settings - Fork 27k
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
After upgrade to 11.1.0 in live logs: [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client #28423
Comments
I can confirm I am seeing the same thing. The docs suggest this syntax is acceptable:
However, given:
I get:
|
@udf2457 I don't think that these are related. |
@udf2457 your issue is probably that you never handle the else case. you will have to end the response if you don't enter the condition as well, I think. (small suggestion, the correct http code for bad request is 400 https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400) |
We found out that we had the following code in our ctx.res.statusCode = 404;
ctx.res.end();
return {
notFound: true,
}; and because of this PR by @timneutkens, this started failing as 404's are now private and that header was being added after we called |
I am getting similar error. any solution suggestions? |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What version of Next.js are you using?
11.1.0
What version of Node.js are you using?
14
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
other
Describe the Bug
Since upgrading to
11.1.0
we're seeing numerous errors that contain this message in our logs:The stacktrace is quite clear:
I tried to go through the history but could not find any changes besides this PR: #27303
Expected Behavior
We reverted back to 10.0.x because the 404 page was breaking too often. Would be nice if the next.js team could help with debugging this.
To Reproduce
Haven't been able to isolate the case where this breaks sadly.
The text was updated successfully, but these errors were encountered: