node-server
node-server copied to clipboard
SSE fetch gets cancelled => Hono Node server prints an error on console
Disposition:
- There is a Hono server, with a POST endpoint replying with Server-Sent Events
- The response is consumed through
fetch().response.body.getReader()Reader - Either (a) the reader cancels via
reader.cancel(), - Or (b) fetch AbortSignal gets aborted
Expectation: things are working well Reality:
- Node.js reports an error:
TypeError: Response body object should not be disturbed or locked:( - You can not catch the error :(( It is just on console
The reproduction repository is on https://github.com/ukstv/hono-sse-repro
The error is from Readable.toWeb(incoming) line. It fails because incoming is "disturbed". That is kind of expected though, as the request got aborted.
Hi @ukstv
Sorry for the late reply. This maybe fixed the latest version. Can you try it?
@yusukebe It works! Thank you!