-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
s3.getObject(params).createReadStream().pipe(res) throws "Error: write after end" #1601
Comments
Same problem!! |
@mcprostar205 First, with regards to what you've tried:
As called out in 1, one thing you should do in general is listen for error events emitted on the response stream. I was finally able to reproduce your issue when using node v6.10.3. Previously I was using the latest version (8.1.3) and wasn't able to trigger it. I think the issue happens because we have a PassThrough stream (used to validate the number of bytes streamed matches the Content-Length) that is configured with It also may explain why #1549 seems to fix this issue. We'll need to review the PR and see if that fixes the error for your use case. Alternatively, we can rewrite the PassThrough stream so that we let node.js handle stream cleanup. Are you able to test your code on the latest version of node to see if you can reproduce it? If the error goes away, then we've probably found part of the problem. |
@chrisradek RE: 1) If I listen to error on the http event stream, what would I do to prevent the exception from being thrown? Or, does #1549 address this issue? RE: 3) Yes, I meant "finish" :-) ...thanks for the catch....sorry. That's great if #1549 may fix the issue on v6.10.3. I'll perform a test in development with the latest AWS SDK and report back. My production environment is on v6.10.3 LTS. We won't be moving production to 7 or 8 in the near future. Are you looking for me to confirm the issues is resolved on node 8 if #1549 didn't resolve this issue to confirm? |
@mcprostar205 Yes, if #1549 does not resolve the issue, could you try the latest version of node.js in development? I wasn't able to reproduce this error when using node.js 8, so if you're still able to encounter it I might need some more info so I can see it as well. |
@chrisradek
A big thank you to you and the AWS team for your professionalism in working with customers to understand and help resolve issues. |
Glad everything's working on your end! Please feel free to reopen if you have any questions or concerns. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
I have a Node.js Express application that is byte-streaming AWS S3 objects and is terminating when the Express response has ended due to user abandoning the connection. The following code successfully streams bytes (videos and audio file) to a media player to the client. The error appears to be recently introduced in AWS S3 streaming. I'm looking for advice on catching this error to prevent process termination.
AWS S3 SDK Reference:
http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/requests-using-stream-objects.html
Node Version : 6.10.3
Express Version : 4.15.3
AWS SDK Version : 2.77.0
Tried With No Effect - Process Still Terminated with "Error: write after end":
Code
S3 ERROR
NODE EXCEPTION
The text was updated successfully, but these errors were encountered: