Skip to content

Navigating to an API handler route 404's in logs. #13195

@Mardoxx

Description

@Mardoxx

Describe the bug

Navigating to an API only route yields a 404 in the console. If we do a redirect inside the api route to the app, it does not update the URL correctly.

Reproduction

https://stackblitz.com/edit/sveltejs-kit-template-default-ipxflmtx

  1. Open dev console
  2. Click the red link
  3. Witness error in console
  4. Observe URL bar is not at the correct route (/moonlight)

Logs

Error: Not found: /out_there
    SvelteKitError control.js:45
    navigate client.js:1312
    _start_router client.js:2175
    _start_router client.js:2066
    start client.js:314
    async* (index):212
    promise callback* (index):211
.localservice@runtime.c8c182a3.js:26:94631
    error .localservice@runtime.c8c182a3.js:26
    handleError app.js:18
    handle_error client.js:1642
    navigate client.js:1312
    _start_router client.js:2175
    _start_router client.js:2066
    start client.js:314
    <anonymous> (index):212
    (Async: promise callback)
    <anonymous> 


### System Info

```Shell
npx envinfo --system --binaries --browsers --npmPackages "{svelte,@sveltejs/*,vite}"
Need to install the following packages:
envinfo@7.14.0
Ok to proceed? (y) 
 
  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @sveltejs/adapter-auto: ^3.3.1 => 3.3.1 
    @sveltejs/kit: ^2.12.1 => 2.12.1 
    svelte: ^5.14.4 => 5.14.4 
    vite: ^6.0.3 => 6.0.3 


### Severity

blocking all usage of SvelteKit

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-decisionNot sure if we want to do this yet, also design work needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions