Repository navigation
Conversation
A file only reached a server function inside a `FormData` that was the only argument. Anywhere else, including as the only argument, the call failed with `SerovalUnsupportedTypeError`, because the serializer has no plugin for files. When the arguments hold files, the client now sends multipart form data: the serialized arguments in one field, and each file in its own part, with the `x-serialized-form` header. A seroval plugin for the call replaces each file with its part's index, wherever seroval finds it. On the server, a plugin created for that request turns the indexes back into the parts, and rejects a missing part or a bad index. Other bodies are read without it, so an index means nothing there. Calls without files are sent as before. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 45cb05c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The 1.x version of #2359.
Problem
On 1.x, a file only reaches a server function inside a
FormDatathat is the only argument. Anything else goes through seroval, which has no plugin forBloborFile, so these calls fail withSerovalUnsupportedTypeError:Change
This is the same design as #2359:
server-runtime.tssends multipart form data, with anx-serialized-formheader.argsfield, and each file goes in its ownfile<i>part.Map,Set,FormDataentries.server-handler.tsreads that form withreadUploadArgs. A plugin created for that request turns each index back into its part, and rejects a missing part, a bad index, or a missingargsfield.x-serialized: true.serializeToJSONStringanddeserializeFromJSONStringtake per-call plugins, tried before the built-in ones.uploads.tscarries the same note as #2359 comparing this with seroval's binary mode.Limits
These are the same as #2359:
request.formData(), with no total size limit.Filevalues.Verification
runtime/uploads.test.tsgo through the real handler (toWebHandler) with the client's request. They cover:Mapand aFormData;server-function-uploadroute plus a Cypress test.packages/start: 129 tests, typecheck and build pass.apps/tests: unit (2) passes. Cypress: 20 of 21 pass, including the new test. The one failure,server-function.cy.ts› "should reject the promise when the response is a 5xx without an X-Error header", fails the same way on clean1.x.🤖 Generated with Claude Code