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
api endpoint hangs and eventually times out when you res.status(204).send('anything') instead of throwing an error #28464
Comments
This looks like a nasty bug, thanks! May I ask, what is the use case for setting status code 204 (No Content) and then providing content anyway? |
Sorry if I wasn't clear, there is no use case. It came about because I was refactoring some code and added some response data to an endpoint that had previously been a 204 and I didn't think to update the http status. The bug is that it causes the lambda to hang until timeout without any error or warning in the code or in typescript. |
This ensures we handle 204 and 304 status codes correctly in API routes. ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [x] Errors have helpful link attached, see `contributing.md` Fixes: #28464
This has been fixed in You can try it out now with |
Wow, you guys got on this fast. Solid. Thanks @styfle 🚀 |
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 (hosted on vercel)
What browser are you using?
chrome
What operating system are you using?
macOS
How are you deploying your application?
Vercel
Describe the Bug
The request hangs and eventually gives a timeout error.
It took me way longer to debug this than it should have. Completely my fault, I admit it.
This isn't an issue when running the app with
yarn dev
It's only an issue for me when it is deployed on vercel.
reminder: http code 204 = no response
Expected Behavior
Some options:
.send()
if the status is a 204To Reproduce
res.status(204).send('message')
when deployed on vercelThe text was updated successfully, but these errors were encountered: