moleculerjs / moleculer-web

:earth_africa: Official API Gateway service for Moleculer framework
http://moleculer.services/docs/moleculer-web.html
MIT License
292 stars 118 forks source link

Avoid stream hanging on error #337

Closed richardgarnier closed 9 months ago

richardgarnier commented 9 months ago

See the documentation on pipe: https://nodejs.org/api/stream.html#readablepipedestination-options

One important caveat is that if the Readable stream emits an error during processing, the Writable destination is not closed automatically. If an error occurs, it will be necessary to manually close each stream in order to prevent memory leaks.

On the current version this leads to responses hanging on both the server and the browser. With this change, this leads to the browser seeing an error (with interrupted stream).

icebob commented 9 months ago

As I see the documentation, the pipeline added in Node 15 only, and moleculer-web current version supports from Node 10.

richardgarnier commented 9 months ago

As I see the documentation, the pipeline added in Node 15 only, and moleculer-web current version supports from Node 10.

As far as I can see, pipeline was added in 10.0. Here is the latest documentation, and here the documentation for version 10.

icebob commented 9 months ago

Hmm, sorry, it looks like I checked the Streams promise API: image