Open djmitche opened 3 years ago
I can confirm that changing
https://github.com/visionmedia/superagent/blob/1277a880c32191e300b229e352e0633e421046c8/src/node/index.js#L1128-L1131
to emit finish
instead fixes this issue.
..half-fixes the issue. Errors (such as a 500 response) are not propagated, even with that change.
Here's a minimal reproduction, tested with node 14 and 15.
The PUT appears (from some tcpdumping and watching logging with
DEBUG=*
) to complete successfully, butthere
anddone
are never printed -- execution ofmain
appears to just cease and node exits normally, suggesting that something, somewhere, isn't calling a callback. MaybeReplacing
await pipeline(stream, req)
withseems to work, but it doesn't catch an error when the
/200
is changed to/400
a few lines higher (probablyend
is emitted first?).I think the issue is that, as a writable stream,
req
should be emittingfinish
and notend
, which is for readable streams.