Skip to content

Error Pages with streamed responses always reporting as 200. #12987

@bertybot

Description

@bertybot

Describe the bug

When creating a page with streamed responses in the load, whether it is in a parent layout or the page itself, the page will always return a 200 regardless of errors thrown.

Error pages will still function and report $page.status correctly but in the network tab and response returned from handle the status will be reported as 200 which causes a bunch of weird side effects in your code when using things like preloadData .

Reproduction

https://sveltelab.dev/f6fb6ey520ivhjy

Please notice that while the error page renders correctly with the right code, the hook reporting the status logs 200 and the network tab shows 200.

Logs

No response

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    Memory: 1.28 GB / 7.47 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.13.1 - ~/.nvm/versions/node/v20.13.1/bin/node
    npm: 10.5.2 - ~/.nvm/versions/node/v20.13.1/bin/npm
    pnpm: 9.6.0 - ~/.nvm/versions/node/v20.13.1/bin/pnpm
  npmPackages:
    @sveltejs/adapter-node: ^5.2.9 => 5.2.9 
    @sveltejs/kit: ^2.8.0 => 2.8.0 
    @sveltejs/vite-plugin-svelte: ^4.0.0 => 4.0.0 
    @sveltejs/vite-plugin-svelte-inspector: ^3.0.1 => 3.0.1 
    svelte: ^5.1.4 => 5.1.4 
    vite: ^5.4.10 => 5.4.10

Severity

serious, but I can work around it

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions