Skip to content

SSE events with multiline data are malformed (only last data line is preserved) #250

@eliasfloreteng

Description

@eliasfloreteng

What version of Elysia is running?

1.4.6

What platform is your computer?

Darwin 25.2.0 arm64 arm

What steps can reproduce the bug?

When an SSE event block contains multiple data: lines, only the last one is preserved in the event object. This drops all intermediate lines and breaks the SSE spec for multiline data payloads.

Example:

data: line 1
data: line 2
data: line 3

Expected result: event.data === "line 1\nline 2\nline 3"
Actual result: event.data === "line 3"

Possibly related to elysiajs/elysia#1466

What is the expected behavior?

All data lines in the SSE block should be concatenated with \n and accessible as a single string in event.data, per the SSE spec.

What do you see instead?

Only the last data line is kept in event.data, all earlier lines are lost.

Additional information

Bug is likely in parseSSEBlock in src/treaty2/index.ts. Multiple data: lines must be joined, not overwritten.

Have you try removing the node_modules and bun.lockb and try again yet?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions