Keep-Alive header changes between 13.1 and 13.2
Unanswered
Chinese softshell turtle posted this in #help-forum
Chinese softshell turtleOP
Hello,
I have an event stream API route that has worked properly on Nextjs 13.1 and started breaking when upgrading to 13.2 and beyond.
The error I'm getting is
Upon further examination I see that somewhere between 13.1 and 13.2, a change was made and now nextjs adds an HTTP response header
Is that an expected change? Is there a way to revert to the old behavior? Any help would be appreciated.
I have an event stream API route that has worked properly on Nextjs 13.1 and started breaking when upgrading to 13.2 and beyond.
The error I'm getting is
BodyTimeoutError: Body Timeout Error and the whole nextjs process crashes.Upon further examination I see that somewhere between 13.1 and 13.2, a change was made and now nextjs adds an HTTP response header
Keep-Alive: timeout=5 . Is that an expected change? Is there a way to revert to the old behavior? Any help would be appreciated.
15 Replies
@Marchy https://nextjs.org/docs/app/api-reference/next-cli#keep-alive-timeout
Chinese softshell turtleOP
Thank you for the prompt reply! I saw that link but I'm currently encountering this while running
next dev (which doesn't seem to accept that cmd line variable), not next start.oh, strange. Maybe this option? https://nextjs.org/docs/app/api-reference/next-config-js/httpAgentOptions
@Marchy oh, strange. Maybe this option? https://nextjs.org/docs/app/api-reference/next-config-js/httpAgentOptions
Chinese softshell turtleOP
Saw this too, but I think that only applies to the client?
No, it only applies to the server
so like if you use fetch in a server component to an external service
Chinese softshell turtleOP
When the server calls
fetch?I see. My api route definitely does not use fetch
Plus, the keep alive seems to be an http response header. a header that is just not there with nextjs 13.1
strange, it might be worth a bug report on github if you can recreate it
Chinese softshell turtleOP
Otherwise the handler is 100% identical, only change is nextjs version
might also want to check canary version in case it's already fixed
Chinese softshell turtleOP
interesting, trying now
With latest canary nextjs just crashes on startup 😅