Closed xvpc closed 1 year ago
Hello, it looks like Vercel is failing to build your project. As you may notice, the errors are preceded by a little triangle icon. This indicates that the message comes from the Vercel CLI.
The error you are getting is:
Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime
This is because when you use the Edge Runtime, eval
etc. are not allowed. The solution would be modifying your code in such a way that you are not relying on eval
or new Function
. It looks like this is coming from the @consumet/extensions
dependency, so you would need to either find another dependency to use, or create an issue in their repository.
I would also note that taking a look at your API routes, none of them will be compatible with the edge runtime. Please take a look at the Next.js docs for more guidance on Edge API routes. https://nextjs.org/docs/pages/building-your-application/routing/api-routes#edge-api-routes
@xvpc Thanks for the issue, as @james-elicx mentioned eval
doesn't work in the edge runtime (regardless on it being run on vercel or cloudflare), so that is not something related to next-on-pages that we can do anything about 😓
If you can remove the code evaluations from your app please do so and let us know if you have other issues (sounds like you've had a bunch with next-on-pages, I'm sorry to hear that 😓)
(PS: I think that your repository is private as it gives me a 404 page)
Hi, Thanks for responding @james-elicx , @dario-piotrowicz I did some research, and I'm well aware of how edge run-time works now. The problem is I need to use this library for my project since there are no other matches, so I was wondering if there's another way to import it into my API other than 'new function' so I can run it with Edge if not thanks anyway.
ah... from the logs it does look like the library is the one doing the code evaluation 😓
Since that's the case I think it is simply a case of the library not being compatible with the edge runtime 😓
I don't think there is much we can do about it 😓, you could try to run your app on Vercel and use the nodejs runtime, I think that should work (but I can't guarantee it, I haven't really tried)
Alternatively if possible you could not use any runtime at all and generate a static Next.js application and deploy it on Cloudflare Pages (as documented here), everything should work fine but you'd lose SSR (but I am not sure if you have routes that need it in your app).
I'm closing the issue as it doesn't seem like something we can fix on our end
sorry we couldn't help you @xvpc 😢, if you stumble across other issues or want to discuss more this one please let me know
next-on-pages environment related information
System: Platform: win32 Arch: x64 Version: Windows 10 Pro CPU: (6) x64 Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz Memory: 16 GB Shell: Unknown Binaries: Node: 18.16.0 Yarn: N/A npm: 9.5.1 pnpm: N/A Package Manager Used: npm Relevant Packages: @cloudflare/next-on-pages: 0.10.1 vercel: N/A next: N/A
Description
I keep getting an error when trying to deploy or build my nextjs app using the command
npx @cloudflare/next-on-pages
Reproduction
GitHub repo https://github.com/xvpc/tpanime-consumet It's a simple self-hosted API that uses a library ( @consumet/extensions ) and displays/organizes its information.
Pages Deployment Method
Pages CI (GitHub/GitLab integration)
Pages Deployment ID
No response
Additional Information
This is not the first error I get when trying to deploy a NextJs app into Cloudflare, Everything works fine when I deploy it to Vercel, I don't understand why It's too hard and frustrating to make it Into Cloudflare pages even tho I tried everything, edge runtime, and many other errors were showing before this I kinda feel stuck now and I'm not finding a fix for my problem, well appreciate if you guys put some offered to fix this problem, thanks.
Would you like to help?