Write after end when piping
See original GitHub issueI have a fairly simple case where I’m building a tarball-stream on the fly and piping it to a request that’s going through follow-redirects
.
It almost immediately crashes with this error:
Error: write after end
at ClientRequest.OutgoingMessage.write (_http_outgoing.js:439:15)
at Writable.RedirectableRequest._write (/home/espenh/webdev/sanity/cli/node_modules/follow-redirects/index.js:170:23)
at doWrite (_stream_writable.js:333:12)
at clearBuffer (_stream_writable.js:440:7)
at onwrite (_stream_writable.js:372:7)
at WritableState.onwrite (_stream_writable.js:89:5)
at CorkedRequest.finish (_stream_writable.js:547:7)
at afterWrite (_stream_writable.js:387:3)
at onwrite (_stream_writable.js:378:7)
at TLSSocket.WritableState.onwrite (_stream_writable.js:89:5)
I’ll see if I can find time to write a reduced test case at some point, but don’t have time right at this moment. Switching to regular HTTP/HTTPS for this request fixes the problem.
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Write after end when piping a ClientRequest to ServerResponse
I believe that finished and writable should have opposite values, since when a OutgoingMessage is closed - it is not writable anymore and...
Read more >NodeError: write after end in NodeJS - Stack Overflow
Your problem is that you're reusing the same cipher multiple times. After it's used in a stream once, it cannot be reused; a...
Read more >Stream | Node.js v19.3.0 Documentation
A key goal of the stream API, particularly the stream.pipe() method, ... Calling the stream.write() method after calling stream.end() will raise an error....
Read more >minipass - npm
Since data written to a Minipass stream is immediately written all the way through the pipeline, and write() always returns true/false based ...
Read more >Streams, Piping, and Their Error Handling in Node.js - Medium
Streams, Piping, and Their Error Handling in Node.js, explained with examples. ... Error [ERR_STREAM_WRITE_AFTER_END]: write after end
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This fixes @olalonde’s test case. Please verify.
@rwpino Thanks, replied there.