Skip to content

reroute hook breaks when deployed on Vercel if the app is deployed as multiple functions #11879

@LorisSigrist

Description

@LorisSigrist

Describe the bug

An App that's deployed to vercel using @sveltejs/adapter-vercel will break if it is both:

  1. Using the reroute hook
  2. Deployed as multiple functions, either because the project is large or it is using split: true

When hitting a route that should get rerouted, it will instead return a 404.

This has caused the localised routing provided by @inlang/paraglide-sveltekit to break when deployed to Vercel. opral/inlang-paraglide-js#32

Reproduction

Repo: https://github.com/LorisSigrist/sveltekit-adapter-vercel-rerotute-bug-reproduction
Deployment: https://sveltekit-adapter-vercel-rerotute-bug-reproduction.vercel.app/

The route /some-page should get rerouted to /, but isn't in production. Instead a 404 is returned

Logs

No response

System Info

System:
    OS: macOS 14.3.1
    CPU: (14) arm64 Apple M3 Max
    Memory: 2.08 GB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.19.1 - /opt/homebrew/bin/node
    npm: 10.2.4 - /opt/homebrew/bin/npm
    pnpm: 8.15.3 - /opt/homebrew/bin/pnpm
  Browsers:
    Safari: 17.3.1
  npmPackages:
    @sveltejs/adapter-vercel: ^5.1.0 => 5.1.0 
    @sveltejs/kit: ^2.0.0 => 2.5.0 
    @sveltejs/vite-plugin-svelte: ^3.0.0 => 3.0.2 
    svelte: ^4.2.7 => 4.2.11 
    vite: ^5.0.3 => 5.1.4

Severity

blocking all usage of SvelteKit (on Vercel)

Additional Information

No response

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