-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ERR_STREAM_WRITE_AFTER_END #6099
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
Comments
Locking |
We have been doing some more testing with this, and it looks like the issue is due to our |
Today we received this error in production, on Here is the full source of the api route it happened on
I can attach the source for the logger package as well, it's a simple Bunyan logger with a stream forwarding errors to Sentry:
|
Why are you calling To return an ok JSON response the nextjs docs suggest: res.status(200).json({ data: { up: true } }) |
You are correct in that you could write this differently, but are you suggesting that we should never use Another example might be for when you need to respond with a 204.
|
Yes, if Why are you returning a value from the API route handler? None of the nextjs examples return anything. I think this may be causing an issue since Sentrys try {
res.json({ data: { up: true } });
return res.status(200).end();
} catch (err) {
logger.warn("Error occurred during diag api check", err);
return res
.status(500)
.send(
"Error occurred while checking dependencies. Failed to connect to DB."
);
} Should this not work without |
I am not certain on this (I will have to double check with the team after holiday), but I think this was in an attempt to fix the warning messages that get created after adding Sentry to our API routes: |
At this point Can you confirm that you only get the error in production? And is this only in production with Vercel? I haven't managed to reproduce this error yet but I haven't tried Vercel yet since it'll be much more painful to debug! |
Hi all - sorry for the delay, I was out for the holidays. I realize that calling |
Happens to us as well. Running Next.js & custom Express server on a Debian Bullseye docker image and Node 18 |
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you label it "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
I spent a day trying to reproduce this issue with no luck. Any help to get this reproduced locally would be much appreciated! |
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you label it "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
This error is still happening to us in prod. Next.js v12, running on Node v18 & |
@lforst yeah - going to upgrade soon. Will update :) |
@lforst Upgrading to 7.30.0 seems to have worked for me. |
@pcardune Awesome! Thanks for letting us know. I will close this issue just to clean up our backlog a bit but feel free to ping us here in case this comes up again. |
We suspect this is still happening on Vercel environments. |
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you label it "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
@lforst it is.. We are experience this issue on Vercel. Any recommended course of action?
|
@flpvsk I recommend upgrading to the latest version of the SDK. This is not something we will address in v7. It also technically shouldn't happen anymore I think. |
Uh oh!
There was an error while loading. Please reload this page.
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
@sentry/nextjs
SDK Version
7.17.2
Framework Version
NextJS 12.3.1
Link to Sentry event
No response
Steps to Reproduce
We're using Sentry with Next.JS on Vercel. Last week we updated from
@sentry/nextjs
version 7.13.0 to 7.16.0, and we started seeing some requests to API endpoints returning 500 errors without any corresponding events in Sentry. We have since updated to@sentry/[email protected]
and are getting the same errors. The Function logs on Vercel show up with an error message forERR_STREAM_WRITE_AFTER_END
.Additional Info:
We tried removing all of the wrapping
withSentry
calls from our API routes, but it didn't stop these errors.Expected Result
No internal stream errors output to Vercel's function logs.
Actual Result
(Line Breaks added for readability)
I believe this to be related to #4151
The text was updated successfully, but these errors were encountered: