nextjs
Hi, I am deploying a nextjs project with /functions to Pages. You can have a preview here at https://q.li2niu.com . But all the apis under /functions return 404 (e.g. https://q.li2niu.com/api/v1/auth/github/redirect )like this post said https://discord.com/channels/595317990191398933/1116287310179352646 . Sadly, the solution is not useful for me.
File arch.
Build command: npx @cloudflare/next-on-pages@1
Build output directory: /.vercel/output/static
Build system version: 1 (latest)
Root directory: /
I tried to change
Build output directory: /.vercel/output
, the apis became OK but the static assets of pages are not correctly loaded. Really confused the 7 Replies
You cannot use the functions directory with
@cloudflare/next-on-pages
, since we create our own worker to use in the build process. Please move the logic in your functions to Next.js Edge API routes.Thanks I will try this way. If I understand your meanings correctly.đź‘Ť
Yeah they need to be moved there but make sure the syntax is also correct
https://nextjs.org/docs/pages/building-your-application/routing/api-routes#edge-api-routes
Routing: API Routes
Next.js supports API Routes, which allow you to build your API without leaving your Next.js app. Learn how it works here.
Yes. I am following the doc. Correctly export runtime.
I have to say your docs are confusing.
The deploy is so slow comparing to Vercel. Is there any trick to accelerate the process? Vercel can use cache.
Not as far as I know. We have to do a fresh build of your nextjs app each time, so that part will always be a limiting factor