-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prerendered page alongside non-GET request handler should be an error #4252
Comments
@benmccann I was looking into this one - I might be misunderstanding the issue, but I think this is already implemented when building. The following can be observed with the StackBlitz link above by running Currently, building with either:
results in the following error after Vite's build output:
That error is thrown here: https://github.com/sveltejs/kit/blob/master/packages/kit/src/runtime/server/page/load_node.js#L389 So am I misunderstanding the issue and/or not seeing a flaw or gap in the current implementation? Or is there some other desired outcome from this issue, like a new test for this case or for the error to be thrown in a context other than when building? |
@tadmccorkle I believe this is about displaying an error page during |
I would like to tackle this issue, can you please assign me |
@pto1026 I tried looking into this one, so I wanted to let you know what didn't work for me - I probably just don't know the correct place to implement the fix. I wanted to make the fix on the dev side of things, and the most appropriate place felt like the plugin.js file where the vite sveltekit plugin is defined. Adding a I tried adding logic to the server's I'm pretty new to the code base, so, again, I'm probably not looking in the right places. Either that, or the fix will touch more code than I was expecting. |
… and #4252 (#4812) * feat: Failing test * feat: Prerendered pages with mutative endpoints fail at runtime * feat: Changeset * fix: clarify with variable * determine prerenderability based on config, not state * rename state.prerender to state.prerendering, remove state.prerendering.default * fix type Co-authored-by: Rich Harris <hello@rich-harris.dev>
Describe the bug
Related to #3294. I don't think there's a situation in which it would make sense to have a non-GET request handler alongside a prerendered page.
In the same vein as #4093 (comment), SvelteKit should throw an error if a prerenderable page (either
export const prerender = true
, orconfig.kit.prerender.default = true
without aexport const prerenderable = false
) has an endpoint with non-GET methods.Reproduction
Add a non-GET method to any page endpoint and mark the page as prerenderable: https://stackblitz.com/edit/sveltejs-kit-template-default-8la3qs?file=src%2Froutes%2Fabout.js&terminal=dev
Logs
No response
System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: