Uncatchable error when upload stream is used in failed pipeline. #2560
Labels
api: storage
Issues related to the googleapis/nodejs-storage API.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Please make sure you have searched for information in the following guides.
A screenshot that you have tested with "Try this API".
N/A. This issue seems to be related to the client library's error handling ability and not the underlying API.
Link to the code that reproduces this issue. A link to a public Github Repository or gist with a minimal reproduction.
https://gist.github.com/thebenperson/c6c1e66653fdc8c05cab52726b2f0664
A step-by-step description of how to reproduce the issue, based on the linked reproduction.
A clear and concise description of what the bug is, and what you expected to happen.
Expected behavior: Stream.promises.pipeline() promise is rejected.
Actual behavior: Program ends due to an unhandled "error" event.
I might have found the problem.
The error from the input stream is passed on to the output stream.
But, no data has been provided from the input stream yet.
This means that this callback hasn't been called yet:
nodejs-storage/src/file.ts
Line 2121 in 740d30d
Meaning pipeline() hasn't been called here yet:
nodejs-storage/src/file.ts
Line 2128 in 740d30d
So that means that there is nothing to handle errors when
emitStream.destroy(e) is called here:
nodejs-storage/src/file.ts
Line 2075 in 740d30d
A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. **
Other types of writable streams do not cause errors like this one.
The writable stream from this library is interfering with the pipeline() function's ability to handle errors.
The text was updated successfully, but these errors were encountered: