Skip to content

Could not deserialize binary form: invalid Content-Length header #15783

@AndreasHald

Description

@AndreasHald

Describe the bug

We are getting quite a few Could not deserialize binary form: invalid Content-Length header errors reported through sentry. When using Remote Function Forms it appears to be because someone is routed through some proxy or cdn that changes the header to Transfer-Encoding chunked and strips out the Content-Length header causing the check here to fail

const content_length = parseInt(request.headers.get('content-length') ?? '');
	if (Number.isNaN(content_length)) {
		throw deserialize_error('invalid Content-Length header');
	}

The request are correctly recieved with these headers (screen grab from sentry)

Image

And in vercel

Image

I'm unsure if it's the routing by vercel that's causing the change in headers.

I'm not knowledgeable enough about that level of details of HTTP but the Vercel help ai seems to suggest that Content-Length cannot be guaranteed.

Reproduction

Unable to be reproduced.

Logs

System Info

System:
    OS: Linux 6.19 Arch Linux
    CPU: (16) x64 Intel(R) Core(TM) Ultra X7 358H
    Memory: 36.51 GB / 62.24 GB
    Container: Yes
    Shell: 5.3.9 - /usr/bin/bash
  Binaries:
    Node: 24.15.0 - /home/hald/.local/share/mise/installs/node/24.15.0/bin/node
    npm: 11.12.1 - /home/hald/.local/share/mise/installs/node/24.15.0/bin/npm
    Deno: 2.7.13 - /usr/bin/deno
  Browsers:
    Chromium: 147.0.7727.101
  npmPackages:
    @sveltejs/adapter-vercel: ^6.3.3 => 6.3.3
    @sveltejs/kit: ^2.56.1 => 2.58.0
    @sveltejs/vite-plugin-svelte: ^6.1.1 => 6.2.1
    svelte: 5.55.4 => 5.55.4
    vite: ^7.3.0 => 7.3.2

Severity

blocking all usage of SvelteKit

Additional Information

I don't think there's any way for us to work around this except drop the usage of the Remote form functions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions