Skip to content

fix: don't attempt to serialize fetch responses when the request body is not a string or TypedArray#16501

Open
Nic-Polumeyv wants to merge 3 commits into
sveltejs:version-3from
Nic-Polumeyv:serialize-fetch-object-body
Open

fix: don't attempt to serialize fetch responses when the request body is not a string or TypedArray#16501
Nic-Polumeyv wants to merge 3 commits into
sveltejs:version-3from
Nic-Polumeyv:serialize-fetch-object-body

Conversation

@Nic-Polumeyv

@Nic-Polumeyv Nic-Polumeyv commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

A universal load fetch with a URLSearchParams, FormData or Blob body crashes SSR with TypeError: value must be a string or TypedArray when the response would be inlined. #1385 guarded serialization on the request body being a string, #6565 re-pointed the check at the response body, and #9801 removed the throw that had been masking the loss. This restores the guard. The response isn't serialized and the browser repeats the fetch.

The client lookup gets the same rule. It hashed only the headers when it couldn't hash the body, so during hydration such a fetch could resolve with a different same-url request's serialized response instead of being sent.

Both tests fail on the base branch.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Jul 24, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 41b690f:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/41b690fe0533d23295dc98cddf34fe74df09c680

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/16501

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

@changeset-bot

changeset-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 41b690f

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

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit 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

@Nic-Polumeyv
Nic-Polumeyv marked this pull request as draft July 24, 2026 23:19
@Nic-Polumeyv
Nic-Polumeyv marked this pull request as ready for review July 24, 2026 23:33
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.

1 participant