Skip to content

Redirect in hooks.servers.ts throw an Error #9234

@ghost

Description

Describe the bug

Calling throw redirect(code, path) throws an Error in preview and production (on Vercel). It works fine in dev.
Seems related to : #8617 and #8690

App created today with npm create svelte@latest

Reproduction

Reproduction repository :
https://github.com/yb-leakmited/svelkit-redirect-error

Logs

Error: {"status":303,"location":"/sign-in"}
    at coalesce_to_error (file:///C:/Users/Leakmited_IT_02/workspace/my-app/.svelte-kit/output/server/index.js:125:7)
    at handle_fatal_error (file:///C:/Users/Leakmited_IT_02/workspace/my-app/.svelte-kit/output/server/index.js:160:51)
    at respond (file:///C:/Users/Leakmited_IT_02/workspace/my-app/.svelte-kit/output/server/index.js:2630:18)
    at async file:///C:/Users/Leakmited_IT_02/workspace/my-app/node_modules/@sveltejs/kit/src/exports/vite/preview/index.js:146:5

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (16) x64 AMD Ryzen 7 5800H with Radeon Graphics
    Memory: 3.53 GB / 15.41 GB
  Binaries:
    Node: 18.13.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.19.3 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.1265.0), Chromium (110.0.1587.57)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.0.0
    @sveltejs/kit: ^1.5.0 => 1.8.6
    svelte: ^3.54.0 => 3.55.1
    vite: ^4.0.0 => 4.1.4

Severity

blocking an upgrade

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp0-urgentSvelteKit is broken or vulnerable for most users

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions