Skip to content

fix: use serializedBody instead of raw body in fetch client SSE handler#3467

Closed
bilby91 wants to merge 1 commit intohey-api:mainfrom
crunchloop:fix/sse-serialized-body
Closed

fix: use serializedBody instead of raw body in fetch client SSE handler#3467
bilby91 wants to merge 1 commit intohey-api:mainfrom
crunchloop:fix/sse-serialized-body

Conversation

@bilby91
Copy link
Copy Markdown
Contributor

@bilby91 bilby91 commented Feb 26, 2026

The makeSseFn function was passing opts.body (the raw JS object) to createSseClient instead of opts.serializedBody, causing POST SSE endpoints with JSON bodies to send [object Object].

The makeSseFn function was passing opts.body (the raw JS object) to
createSseClient instead of opts.serializedBody, causing POST SSE
endpoints with JSON bodies to send [object Object].

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 26, 2026

@bilby91 is attempting to deploy a commit to the Hey API Team on Vercel.

A member of the Team first needs to authorize it.

@pullfrog
Copy link
Copy Markdown
Contributor

pullfrog Bot commented Feb 26, 2026

Leaping into action...

Pullfrog  | View workflow run | Using OpenCode | Triggered by Pullfrogpullfrog.com𝕏

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Feb 26, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 26, 2026

⚠️ No Changeset found

Latest commit: 2757954

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dosubot dosubot Bot added the bug 🔥 Broken or incorrect behavior. label Feb 26, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 40.11%. Comparing base (11f5470) to head (2757954).
⚠️ Report is 377 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3467   +/-   ##
=======================================
  Coverage   40.11%   40.11%           
=======================================
  Files         478      478           
  Lines       17488    17488           
  Branches     5294     5294           
=======================================
  Hits         7016     7016           
  Misses       8425     8425           
  Partials     2047     2047           
Flag Coverage Δ
unittests 40.11% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

return createSseClient({
...opts,
body: opts.body as BodyInit | null | undefined,
body: opts.serializedBody as BodyInit | null | undefined,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bilby91 how would this fix it? there's already serializedBody below and that's what's used

@bilby91
Copy link
Copy Markdown
Contributor Author

bilby91 commented Mar 23, 2026

Closing this PR — after rebasing with main and reviewing the code more carefully, the fix is not needed.

createSseClient in serverSentEvents.ts already overrides body with serializedBody internally:

const requestInit: RequestInit = {
  redirect: 'follow',
  ...options,
  body: options.serializedBody,  // ← always uses serializedBody regardless of what body was set to
  headers,
  signal,
};

So the body property set at the makeSseFn call site is effectively ignored. The issue I hit in 0.92.3 was likely in a version before this override existed in createSseClient.

Thanks @mrlubos for pointing this out!

@bilby91 bilby91 closed this Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🔥 Broken or incorrect behavior. size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants