missing prerendered route with load function returns internal error instead of 404 #8751
Labels
bug
Something isn't working
p1-important
SvelteKit cannot be used by a large number of people, basic functionality is missing, etc.
Milestone
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
A client-side navigation to a route that:
prerender = true
.load
function.load
function.incorrectly returns internal error
500
instead of a404
when navigating to a non-existent dynamic parameter.This is because the response for the
/__data.json
of the non-existent route is returned as HTML instead of JSON.Then, the client-side router tries to parse the HTML response as JSON, throwing an error, and causing a 500 failed page render.
Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-sswrw5?file=src/routes/+layout.svelte
npm run build && npm run preview
in the terminal2
into the text input.Expected
Error page returns 404
Actual
Error page returns 500
Logs
Server logs
Browser console
System Info
Severity
serious, but I can work around it
Additional Information
No response
The text was updated successfully, but these errors were encountered: