Skip to content

Vercel ISR strips payload query parameter from remote function endpoints on rest parameter routes #15085

@arichardsmith

Description

@arichardsmith

Describe the bug

Remote functions fail on Vercel production deployments when a rest parameter route (e.g., /[...rest]) is configured with ISR (Incremental Static Regeneration) settings. The payload query parameter used to pass arguments to remote functions is stripped out by Vercel's ISR implementation, causing the validation to fail.

Remote functions create endpoints at the route /_app/remote/[id]/[function]?payload={encoded arguments}. When a rest parameter route (i.e., /[...rest]) matches all routes, the function built to handle this route also handles remote function calls.

When ISR is configured for that route, Vercel strips out any query parameters that aren't explicitly allowed in the configuration—which includes the payload parameter used to pass remote function arguments.

Reproduction

I've got a minimal reproduction here: github.com/arichardsmith/sveltekit-vercel-remote-bug and a deployment is available on Vercel to poke at.

In short:

  • Create a rest parameter route at the root level (i.e. routes/[...rest])
  • Set the ISR config in routes/[...rest]/+page.server.ts
  • Try to call a remote function with parameters from any page in the app

Logs

This is the error on the server, even though I'm passing the arguments.

Remote function schema validation failed: [
  {
    expected: 'array',
    code: 'invalid_type',
    path: [],
    message: 'Invalid input: expected array, received undefined'
  }
]

System Info

System:
    OS: macOS 15.6.1
    CPU: (8) arm64 Apple M1
    Memory: 78.83 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.11.1 - /nix/store/h57ln4r40qr349z1r8ri90n9i9xid3r5-nodejs-24.11.1/bin/node
    npm: 11.6.2 - /nix/store/h57ln4r40qr349z1r8ri90n9i9xid3r5-nodejs-24.11.1/bin/npm
    pnpm: 10.25.0 - /nix/store/nxr10pnynlzqsfcnc4h4zv2724a8i7v8-pnpm-10.25.0/bin/pnpm
  Browsers:
    Chrome: 143.0.7499.147
    Firefox: 145.0.1
    Safari: 18.6
  npmPackages:
    @sveltejs/adapter-vercel: ^6.2.0 => 6.2.0
    @sveltejs/kit: ^2.49.1 => 2.49.2
    @sveltejs/vite-plugin-svelte: ^6.2.1 => 6.2.1
    svelte: ^5.45.6 => 5.46.0
    vite: ^7.2.6 => 7.3.0

Severity

serious, but I can work around it

(It is particularly nasty as it only shows up when deployed)

Additional Information

This can be worked around by explicitly allowing payload query parameters in the ISR config:

export const config = {
	isr: {
		expiration: 60,
		allowQuery: ['payload']
	}
};

An easy fix would be for adapter-vercel to automatically add payload to the allowQuery, as is currently the case with __pathname. However, this would mean payload should be a reserved parameter, like __pathname is, which I guess would technically be a breaking change?

I'd be happy to file a PR if automatically adding the parameter (if there are remote functions in the app) is the preferred solution.

That said, using the rest parameter route handler for remote functions could cause issues down the road. Is there a reason remote functions aren't split into separate Vercel functions during the build?


Sorry for bringing Scrooge vibes filing an issue over Christmas, hopefully gift wrapping it with a repro helps take the edge off. Happy holidays and there's nothing wrong with this sitting unaddressed until after the holidays.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions