-
Notifications
You must be signed in to change notification settings - Fork 126
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
[🐛 Bug]: When returning an empty paths array from getStaticPaths I get error: Failed to produce a Cloudflare Pages build #274
Comments
Hello, sorry to hear you're encountering a problem with When using It sounds like what might be happening is that because you have no paths in your array, Next.js might be ignoring the If you would like to use dynamic pages instead of SSG'd ones, please either opt your route into the edge runtime or remove the use of |
@Qavi-Nizamani I can see that you're using (PS: I'm sorry |
It works in development server with this command: npx wrangler pages dev .vercel/output/static --compatibility-flag=nodejs_compat But when deployed on cloudflare pages it is still showing 500 internal server error. |
Yes I have checked that it is running @cloudflare/next-on-pages v1
|
I see.... that's really strange then... (I can't imagine why something would work locally but not in production) I'm not really sure, we'll have to investigate this 😓 If there is any more info/code you could provide that would really help 🙂 |
@Qavi-Nizamani I've created this simple application by following your instructions + adding the edge runtime export: empty-getstaticpaths-pages-13.4.4/slug.js It seems to work fine locally, I've also deployed it and it seems to be ok there too: Could you check my application and see if I am missing some steps to reproduce the issue? |
I've created a PR to document that the Besides that I'm closing the issue due to inactivity. @Qavi-Nizamani if you circle back to this and still have problems with your application feel free to open a new issue or let me know here 🙂 |
next-on-pages environment related information
System:
Platform: win32
Arch: x64
Version: Windows 10 Home
CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
Memory: 8 GB
Shell: Unknown
Binaries:
Node: 16.14.0
Yarn: 1.22.19
npm: 8.3.1
pnpm: N/A
Package Manager Used: npm
Relevant Packages:
@cloudflare/next-on-pages: 0.10.1
vercel: N/A
next: N/A
Description
export async function getStaticPaths() {
let paths = [];
return { paths, fallback: false };
}
If I return an empty paths array, from getStaticPaths() function I get an error.
The above code is just an example when we have no dynamic pages yet, but surely will be added in future.
Reproduction
Create a new Next.js project
Install next-on-pages: npm install --save-dev @cloudflare/next-on-pages
Create a dynamic page [slug].js, And add this code to that file
running this command: npx @cloudflare/next-on-pages --experimental-minify
It shows this error.
Pages Deployment Method
None
Pages Deployment ID
No response
Additional Information
Everything works fine if I return at least a single param from the getStaticPaths.
Would you like to help?
The text was updated successfully, but these errors were encountered: