[🐛 Bug]: Failed to generate SSG dynamic routes due to Vercel CLI breaking change #833
Closed
1 task done
Labels
bug
Something isn't working
next-on-pages environment related information
Description
Overview
We have statically generated dynamic route pages on our website, opting out of dynamic params, as explained in the documentation here.
Here is the code of our example page with path src/app/[slug]/page.tsx:
The build then fails with this error:
Investigation
It looks like the issue appears after Vercel Release 35.0.1 due to this commit.
Explanation:
Newer versions of Vercel CLI build command generate
[slug].func
and[slug].rsc.func
in.vercel\output\functions
without generatingprerender-config.json
for these, let's call them, "placeholder" dynamic route functions. Before this Vercel release, function directories of that type were not present as they were being deleted. I think the addition of this code made the build failing.Then,
getRouteConfig
function marks these functions as invalid and outputsInvalid prerender config for /[slug]
, since it cannot find the prerender-config for them.These functions are left as invalid and the build fails here
Solution
Our temporary fix is to add Vercel package with version previous to 35.0.1.
I believe an exception for these functions SSG dynamic route functions should be added in
checkInvalidFunctions
.Reproduction
Create a sample project with dynamic routes,
generateStaticParams
function andexport const dynamicParams = false
.Make sure you don't have vercel npm package installed (to get the latest version), or install vercel package with version greater than 35.0.1.
Run
npx @cloudflare/next-on-pages@1
and you will see the build failing with:Pages Deployment Method
None
Pages Deployment ID
No response
Additional Information
No response
Would you like to help?
The text was updated successfully, but these errors were encountered: