-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Vercel adapter: parameter "functionPerRoute" generate serverless function even for prerendered routes #10211
Comments
Your example doesn't have prerendered pages. Please update the example to match the problem you're describing. |
Hello @bentouch-digital. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with |
@matthewp Hello, the ouput is "hybrid", unless I'm mistaken all pages are prerendered by default, so the index.astro is a prerendered one. |
Good first issue!This is an opportunity for astro users to learn about how astro works by fixing a small but real bug. You can expect to get help setting up the dev environment, and understanding the project structure in What's the bug?The What's going wrong here?Adapters depend on Astro's Integration API to provide them with the routes to make functions out of. The routes are provided in a map called Neither Astro nor the vercel adapter make a distinction between prerendered and on-demand rendered routes - all are turned into functions. Only non-prerendered routes should be exposed to the adapter. Where do I start looking?The part where Astro's internals pass the astro/packages/astro/src/core/build/plugins/plugin-manifest.ts Lines 98 to 106 in eb8bffe
The part where Astro's internals populate the astro/packages/astro/src/core/build/plugins/plugin-ssr.ts Lines 201 to 206 in eb8bffe
|
@lilnasy Thanks for providing guidance on this issue! I would like to give it a try 🙂 |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
All
Describe the Bug
Actually, when I build the projet with the Vercel adapter and the parameter
functionPerRoute
totrue
, it generates serverless functions for all routes, prerendered ones too. I have a route named [...slug].astro that generates only prerendered pages. But with this configuration it generates a serverless function [...slug].astro, as the result, all 404 errors fallback on this serverless function and a response is returned with code 200. If i setfunctionPerRoute
tofalse
, it's works as intended.What's the expected result?
Must not generate serverless functions for prerendered pages.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-9beo4b
Participation
The text was updated successfully, but these errors were encountered: