Skip to content

fix(core): make streaming upload reachable in Node#776

Merged
hugomrdias merged 1 commit into
masterfrom
rvagg/fix-streaming-content-length
May 7, 2026
Merged

fix(core): make streaming upload reachable in Node#776
hugomrdias merged 1 commit into
masterfrom
rvagg/fix-streaming-content-length

Conversation

@rvagg
Copy link
Copy Markdown
Collaborator

@rvagg rvagg commented May 7, 2026

Two for the price of one:

  1. supportsStreamingFetchBody() probed new Request('', ...), which throws in Node (no base URL). The catch returned false, so the streaming branch in uploadPieceStreaming() was unreachable in Node, consumers silently buffer the full pipeline into a Blob. Use an absolute URL for the probe.

  2. Restructure header construction so Content-Length is only set on the drain-to-Blob fallback. On streaming bodies length is conveyed via chunked encoding.

Originally surfaced after investigating a problem reported here: FilOzone/foc-devnet#103
I haven't reproduced that problem, but it is correct to not set Content-Length for streaming bodies.

supportsStreamingFetchBody() probed `new Request('', ...)`, which throws
in Node (no base URL). The catch returned false, so the streaming branch
in uploadPieceStreaming() was unreachable in Node, consumers silently
buffer the full pipeline into a Blob. Use an absolute URL for the probe.

Restructure header construction so Content-Length is only set on the
drain-to-Blob fallback. On streaming bodies length is conveyed via
chunked encoding.

Originally surfaced after investigating a problem reported here:
	FilOzone/foc-devnet#103
I haven't reproduced that problem, but it is correct to not set
Content-Length for streaming bodies.
@rvagg rvagg requested a review from hugomrdias as a code owner May 7, 2026 12:35
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FOC May 7, 2026
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
synapse-dev ce46a7c Commit Preview URL

Branch Preview URL
May 07 2026, 12:43 PM

@BigLep BigLep moved this from 📌 Triage to 🔎 Awaiting review in FOC May 7, 2026
@github-project-automation github-project-automation Bot moved this from 🔎 Awaiting review to ✔️ Approved by reviewer in FOC May 7, 2026
@hugomrdias hugomrdias merged commit 3236a27 into master May 7, 2026
12 of 13 checks passed
@hugomrdias hugomrdias deleted the rvagg/fix-streaming-content-length branch May 7, 2026 15:54
@github-project-automation github-project-automation Bot moved this from ✔️ Approved by reviewer to 🎉 Done in FOC May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

3 participants