Skip to content

fix(rivetkit): send request bodies as bytes for browser clients - #5802

Merged
eersnington merged 1 commit into
mainfrom
stack/fix-rivetkit-send-request-bodies-as-bytes-for-browser-clients-krwoyzyq
Oct 2, 2026
Merged

eersnington merged 1 commit into
mainfrom
stack/fix-rivetkit-send-request-bodies-as-bytes-for-browser-clients-krwoyzyq

Conversation

@eersnington

@eersnington eersnington commented Sep 28, 2026 •

Copy link
Copy Markdown
Member
  • Send HTTP request bodies from the RivetKit client as bytes instead of a ReadableStream with duplex: "half". Since feat(http): stream HTTP bodies end-to-end #5516, action calls on a handle without .connect() failed in Safari, Firefox, and Chromium over HTTP/1.1.
  • Read the body of a Request passed to handle.fetch() as bytes. Firefox has no Request.body, so the body was dropped.
// engine-client/actor-http-client.ts
const bytes = await actorRequest.arrayBuffer();
if (bytes.byteLength > 0) bodyToSend = bytes;
return fetch(gatewayUrl, { method, headers, body: bodyToSend, signal });
Runtime Before After
Node, Bun, Deno works works
Chromium, HTTP/2+ works works
Chromium, HTTP/1.1 Failed to fetch works
Safari / iOS fails works
Firefox body dropped works

@railway-app

railway-app Bot commented Sep 28, 2026

Copy link
Copy Markdown

This PR was not deployed automatically as @eersnington does not have access to the Railway project.

In order to get automatic PR deploys, please add @eersnington to your workspace on Railway.

@claude

claude Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review

The fix is small and targeted. Buffering the body as bytes is the right approach for browsers. I found no blocking issues.

Observations

  • No test coverage. The regression (HTTP/1.1 Chromium, Safari, Firefox) can't be caught by Node-only driver tests. A test that sends a Request with a body through sendHttpRequestToGateway and rawHttpFetch would help. It should cover a Request passed to handle.fetch() and one with an empty body, using real infrastructure.
  • Streaming uploads are now buffered. Large or streaming request bodies are fully read into memory before sending. That is a reasonable tradeoff for browser compatibility, but a short note may be worth adding.
  • readRequestBody abort behavior. Please confirm that an already-aborted signal rejects cleanly with an AbortError and leaves no unhandled rejection.
  • Empty-body headers. When bytes.byteLength === 0, content-length and transfer-encoding are left in place. This is probably fine, but confirm a stale content-length can't mismatch.
  • Duplicated GET/HEAD check. rawHttpFetch re-implements the method check that sendHttpRequestToGateway also has. This is minor.
  • Style. The comments follow the repo conventions. Dropping the as RequestInit cast and duplex is a nice cleanup.

Overall this looks good to merge, with a regression test as a nice-to-have.

@the-company-company the-company-company Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 1 medium-severity finding

Reviewed commit 2ac03e0.

@eersnington
eersnington force-pushed the stack/fix-rivetkit-send-request-bodies-as-bytes-for-browser-clients-krwoyzyq branch from 2ac03e0 to 275067c Compare September 28, 2026 15:01

@the-company-company the-company-company Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ No issues found

Reviewed commit 275067c.

@eersnington
eersnington force-pushed the stack/fix-rivetkit-send-request-bodies-as-bytes-for-browser-clients-krwoyzyq branch from 275067c to e401599 Compare October 1, 2026 22:20
@eersnington
eersnington force-pushed the stack/fix-rivetkit-send-request-bodies-as-bytes-for-browser-clients-krwoyzyq branch from 9a8e780 to 6161d86 Compare October 2, 2026 00:17
@eersnington
eersnington merged commit 4e3fe3a into main Oct 2, 2026
5 of 10 checks passed
@eersnington
eersnington deleted the stack/fix-rivetkit-send-request-bodies-as-bytes-for-browser-clients-krwoyzyq branch October 2, 2026 00:21
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.

2 participants