Error Pages with streamed responses always reporting as 200.
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked SvelteLab reproduction and compare the streamed-response error page's network status with the status reported by the hook and returned from handle. Check the behavior with streamed loads in both a parent layout and the page itself, including the preloadData side effect. Done means the rendered error page and $page.status remain correct while the network response and handle report the actual error status.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100