Skip to content

fix(sdk): handle SSE cancellation rejection - #47966

Open
arkaydeus wants to merge 2 commits into
anomalyco:devfrom
arkaydeus:sdk-sse-abort
Open

fix(sdk): handle SSE cancellation rejection#47966
arkaydeus wants to merge 2 commits into
anomalyco:devfrom
arkaydeus:sdk-sse-abort

Conversation

@arkaydeus

Copy link
Copy Markdown

Issue for this PR

Closes #47963

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The SSE abort handler called reader.cancel() without observing its promise, so Bun could report an unhandled AbortError after the body stream had already errored.

This observes the cancellation rejection in both generated SDK clients and patches the v2 generation step so regeneration preserves the fix.

How did you verify your code works?

  • Ran ./script/generate.ts to regenerate the SDK and confirm the patch is preserved.
  • Ran bun test and bun typecheck from packages/sdk/js.
  • Added a regression test that errors the body stream while reader.read() is pending. The test fails with the previous implementation because Bun sees the unhandled rejection.

Screenshots / recordings

Not applicable; this is an SDK-only change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SDK SSE abort leaks an unhandled reader.cancel() rejection under Bun

1 participant