Skip to content

node-server doesn't flush headers until content is written to it #244

@td0m

Description

@td0m

What version of Hono are you using?

4.7.11

What runtime/platform is your app running on? (with version if possible)

Node v23.8.0

What steps can reproduce the bug?

on @hono/[email protected]. make SSE endpoint that waits before sending content:

router.get("/foo", (c) => {
  return streamSSE(c, async (sse) => {
    // headers don't get written for a minute
    await sse.sleep(60_000);
    await sse.write("hi");
  });
});

What is the expected behavior?

Headers getting flushed. You can see this e.g. by visiting in Chrome and checking the status header:
Image

What do you see instead?

Headers not getting flushed until we sse.write:
Image

Additional information

I believe headers getting flushed is the expected behaviour. I tested the exact same code in Deno, works as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions