honojs / node-server

Node.js Server for Hono
https://hono.dev
386 stars 47 forks source link

SSE fetch gets cancelled => Hono Node server prints an error on console #179

Closed ukstv closed 2 months ago

ukstv commented 4 months ago

Disposition:

  1. There is a Hono server, with a POST endpoint replying with Server-Sent Events
  2. The response is consumed through fetch().response.body.getReader() Reader
  3. Either (a) the reader cancels via reader.cancel(),
  4. Or (b) fetch AbortSignal gets aborted

Expectation: things are working well Reality:

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.

yusukebe commented 3 months ago

Hi @ukstv

Sorry for the late reply. This maybe fixed the latest version. Can you try it?

ukstv commented 2 months ago

@yusukebe It works! Thank you!