Skip to content

fix(web): send a GET server function call with file arguments over POST - #5177

Closed
Marve10s wants to merge 3 commits into
solidjs:mainfrom
Marve10s:fix-server-get-file-arguments
Closed

Marve10s wants to merge 3 commits into
solidjs:mainfrom
Marve10s:fix-server-get-file-arguments

Conversation

@Marve10s

@Marve10s Marve10s commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Narrowed per review. Two bugs in a GET server function's client send:

  • With enableRichArguments(), a file among the arguments made serializeArguments return a FormData, which went into the url as ?args=%5Bobject%20FormData%5D, and the server answered 400. The call now throws A GET server function cannot send files: use POST before sending. Without the codec, a file still throws the existing "pass a single Blob/FormData/File argument" error. GET never switches to POST because of a file.
  • When codec arguments were too long for a url, the POST fallback encoded them a second time. A one-shot argument such as an async iterator was already drained, so it arrived with no chunks. GET now passes the encoding it already made as the request body, and the codec branch of initializeResponse sends it.

JSON-safe calls and short codec strings keep the same GET url and cache key.

Size

+106 B minified on every server-function page, measured locally with the native compiler over main @ caba92a. Five scenarios go past their caps, so this PR re-records them at measured + 10 B with ledger lines in scripts/size/scenarios.js: compiled live server components, base + router, live + router, and the frozen base and live server components floors in floor-caps.json.

Size-Exception: a GET server function with a file among its codec arguments sends a 400-bound request instead of failing clearly, and its long-argument POST fallback drops one-shot arguments; the clear error and the single encoding cost 106 B minified on server-function pages.

How did you test this change?

  • packages/web/test/server/server-functions-uploads.spec.tsx: with the codec, a GET call holding a file (alone, after another argument, inside a FormData, or a Blob inside an object) rejects with the new error and sends no request. A one-shot async iterator beside a 3,000-character argument arrives with all its chunks when the call goes over POST. On main the file cases fail with Server function call failed with status 400 and the iterator case receives chunks: [].
  • packages/web/test/server/server-functions-body-formats.spec.tsx: without the codec, a GET call with a File still asks for enableRichArguments and sends no request.
  • Rebased on main @ caba92a. pnpm build, pnpm test (39 of 39 tasks), Prettier, and the size gate against main's measurement pass.

@changeset-bot

changeset-bot Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5a13049

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@solidjs/web Patch
@solidjs/diagnostics Patch
@solidjs/signals Patch
solid-js Patch
@solidjs/universal Patch

Not sure what this means? Click here to learn what changesets are.

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

@codspeed

codspeed Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

2 warnings

⚠️ Upgrade your CodSpeed plugin for Node.js 24

@codspeed/* 5.4.0 is only tested on Node.js 18, 20, and 22, so your Node.js 24 measurements may be inaccurate. Upgrade your @codspeed/* packages to 6.0.0 or later.

See affected benchmarks

⚠️ 1 benchmark is dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 205 untouched benchmarks
⏩ 5 skipped benchmarks1


Comparing Marve10s:fix-server-get-file-arguments (5a13049) with main (caba92a)

Open in CodSpeed

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Copy link
Copy Markdown
Member

Thanks for tracking this down. Both bugs are real: a GET call with the codec on turns a file into ?args=[object FormData] and gets a 400, and the long-argument fallback encodes the arguments twice.

Could you narrow the fix, though? Choosing GET or POST should stay the developer's call, so a GET with a file shouldn't quietly switch to POST. Could you instead:

  • throw a clear error when GET's arguments serialize to a FormData (with the codec on), the way the no-codec path already throws "pass a single Blob/FormData/File argument", and keep that throw for the no-codec case too;
  • keep the fix where the long-argument POST fallback encodes the arguments once, plus its test (the one-shot iterator beside a long codec argument).

That should cost far fewer than 118 B, and may not need the cap raises at all.


Generated by Claude Code

… to POST

Narrowed per review. A GET server function whose codec arguments encode to
multipart form data (a file among them) now throws "A GET server function
cannot send files: use POST" before sending, instead of putting
`[object FormData]` in the url. Without the codec, a GET call with a file
still throws the existing enableRichArguments error.

The long-argument POST fallback keeps the encoding it already made: GET
passes it as the options body and the codec branch of initializeResponse
sends it, so a one-shot argument such as an async iterator arrives with all
its chunks.

Size: +106 B minified on every server-function page. Caps raised at
measured + 10 B over main @ 5420b4a for compiled base, compiled live and
live + router, and for the frozen live page floor, which needs a
Size-Exception line in the PR body.
…-argument error

+106 B minified on every server-function page, measured locally with the
native compiler over main @ caba92a. Two frozen floors (base and live
server components) move and need a Size-Exception line in the PR body.
@Marve10s
Marve10s force-pushed the fix-server-get-file-arguments branch from fdda428 to 5a13049 Compare December 1, 2026 16:53
ryansolid pushed a commit that referenced this pull request Dec 2, 2026
Carries #5177 (Marve10s) over main @ 9f7d51d. The conflicts were the
size ledger only: main's #5287 re-record is kept and #5177's growth
(+106 B minified on every server-function page) is re-measured on top.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC

Copy link
Copy Markdown
Member

Thanks @Marve10s! This landed through #5288, which carries your commits unchanged. Main had just re-recorded the same size scenarios, so it merges main in and re-measures the caps on top. Closing this in favour of that one.

— Claude via Claude Code


Generated by Claude Code

ryansolid added a commit that referenced this pull request Dec 2, 2026
… long-argument encoding once (carries #5177) (#5288)

* fix(release): skip already-published packages in artifact verification

Since #4985, h, html and element version on their own, so a core release
leaves them at a version already on npm. verify-release-artifacts.mjs
dry-run-published every public package, and npm refuses even a dry run over
a published version, so the 2.0.1 release failed before publishing anything.
It now skips a published version the same way release.mjs does, with
packageIsPublished shared from release-packages.mjs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC

* fix(signals): a reader linked to a settled source no longer stays pending on it

retryReaches counted a dep that is the source itself as a path even after
that source settled, so settleFamily and the re-park sweep in recompute
kept a settled derive node in a reader's pending sources. With an
optimistic store over one async memo and a slower sibling memo whose
re-ask answers unchanged, the reader stayed pending and the action's
transaction never landed. A direct link now counts only while the source
is pending.

Claude-Session: https://claude.ai/code/session_01CP9T3j2CTCEPyTS2bcKsBu

* fix(web): send an empty revalidate declaration as a non-empty header

* fix(compiler): treat only a leading comment equal to the static marker as the marker

* fix(web): a server function's ReadableStream result stays a ReadableStream

The top-level abort wrapper for streamed results matched any async
iterable, so a decoded ReadableStream (which is one in Node and Chrome)
was replaced by a plain iterable and lost getReader/pipeTo/tee. Leave a
ReadableStream out of that check; it passes through as it already does
when nested. Test shape from #5175.

Co-authored-by: Marve10s <igrimanigroman@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWMpyUtA1ZFwzKmr1sg

* fix(web): check getReader instead of instanceof ReadableStream

The instanceof check with its typeof guard cost +59 B minified on every
server-function page and put three page scenarios over their caps. A
decoded ReadableStream is told apart from an async generator's result by
its getReader method.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWMpyUtA1ZFwzKmr1sg

* fix(web): write the empty revalidate header once; digest it to no keys

Send `,` in one header write when the joined keys are only whitespace,
and digest `X-Revalidate` with empty keys filtered, so an empty
declaration reads as `[]` on the outcome instead of `[""]` or
`["", ""]`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC

* fix(release): wait for the dispatched compiler binary run before watching it

The 2.0.4 publish stopped at `gh run watch`: `gh workflow run` printed
the new run's URL, and watching it one second later returned 404 because
the run was not readable yet. Poll `gh run view` until it resolves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC

* fix(release): poll the compiler binary run instead of gh run watch

The 2.0.4 re-run got past the run lookup, then `gh run watch` failed on
the run's jobs (HTTP 404) before GitHub had created them. Poll
`gh run view --json status,conclusion` until the run completes, retrying
failed reads, and check the conclusion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC

* fix(signals): a re-parked reader drops a pending source disposed while loading

The re-park prune in recompute kept any carried source still flagged
STATUS_PENDING, on the assumption that its own settle walk is still to
come. A source disposed while loading keeps that flag but never lands, so
no walk comes. When a reader parked on an async memo whose owner then
re-ran in the same hold, disposing it and creating a replacement that
failed, the reader stayed pending on the disposed memo: the hold never
landed and its staged error never reached the boundary. A disposed source
is now dropped whatever its status, as retryReaches and holdsOn already
treat a disposed node as holding nothing (F-3).

* chore(size): re-record the six scenarios over their caps on main

After the 11-24 fix batch and 2.0.4, six scenarios sat over their brotli
caps with 9-14 B of minified allowance left (warnings on main, but the
next ~10 B client fix would fail the gate). Caps move to CI's measure on
5420b4a + 10 B and recorded minified resets to the measure. No floors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC

* chore(signals): pin Sparkplug tiering in the signals bench lane

Same flag as the web server lane (#5157). In #5141's fork runs it took
the signals lane from one benchmark varying by more than 5% across
fresh runners to none, and #4906's omit ownKeys -63% reads 226k vs 235k
instructions pinned (673k vs 237k unpinned). Benchmark mode only: the
test suite runs in worker threads, which reject V8 flags in execArgv.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC

* chore(size): re-record the three scenarios over their caps on main

After #4906, #5209 and #5218, until/refresh, base server components and
live server components sat 5-15 B brotli over their caps, so the size gate
failed on every PR. Caps move to CI's measure on main @ 50a4bfd + 10 B and
recorded minified resets to the measure. The two page scenarios are frozen
floors (floor-caps.json).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC

* feat(web): add Link headers for the client entry's assets

* fix(web): hint entry scripts with preload as=script for Early Hints

* fix(web): encode non-BMP characters in Link targets as whole code points

* fix(web): append stub Link values to the base response head

* test(signals): gate the affects(list) holder test on a promise, not a 20 ms timer

The test checked the marks after three settle() ticks while the action
waited on a 20 ms timer. On a loaded CI machine the ticks can outlast the
timer, so the action landed first and the check saw [false, false, false]
(failed on #5230's CI). The action now waits on a gate the test releases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC

* chore(size): re-record the four scenarios over their caps on main

After #5221, #5225, #5228, #5235 and #5236, until/refresh, compiled base
server components, base + router and live + router sat 6-92 B brotli over
their caps. Caps move to CI's measure on main @ f7b6b9c + 10 B and recorded
minified resets to the measure. No floors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC

* chore(size): raise the renderToString floor for the entry Link header (#5230)

Server only: +511 B minified, +195 B brotli measured locally over main @ 8fa0476.
Client eager chunks are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC

* fix(signals): clear held error on outer boundary when inner error boundary handles next error (#5261)

* docs(signals): update D-38 src citation count in RULES-INDEX

* fix(signals): defer mid-flush unhandled async diagnostic until settle (#5203)

* fix(web): send a GET server function call with file arguments over POST

* fix(web): refuse file arguments in a GET call instead of switching it to POST

Narrowed per review. A GET server function whose codec arguments encode to
multipart form data (a file among them) now throws "A GET server function
cannot send files: use POST" before sending, instead of putting
`[object FormData]` in the url. Without the codec, a GET call with a file
still throws the existing enableRichArguments error.

The long-argument POST fallback keeps the encoding it already made: GET
passes it as the options body and the codec branch of initializeResponse
sends it, so a one-shot argument such as an async iterator arrives with all
its chunks.

Size: +106 B minified on every server-function page. Caps raised at
measured + 10 B over main @ 5420b4a for compiled base, compiled live and
live + router, and for the frozen live page floor, which needs a
Size-Exception line in the PR body.

* chore(size): re-record the server-function page caps for the GET file-argument error

+106 B minified on every server-function page, measured locally with the
native compiler over main @ caba92a. Two frozen floors (base and live
server components) move and need a Size-Exception line in the PR body.

* test(solid): type the #5203 spec's object fallback for test-types

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC

* chore(size): re-record the caps the nested Errored release grows (#5269)

+57 B minified on pages with error boundaries (the parent walk in keeps()).
Accepted by the maintainer; three trims measured, none smaller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: gnovotny <g.novotny@gmx.ch>
Co-authored-by: Marve10s <igrimanigroman@gmail.com>
Co-authored-by: gnovotny <990945+gnovotny@users.noreply.github.com>
Co-authored-by: Brenley Dueck <brenleydueck@gmail.com>
Co-authored-by: MilindChatrabhuji <milind.chatrabhuji@gmail.com>
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