Wanted to opt-out for edge deploy

Hello, I have a website developed with NextJS 13 (pages dir). I wanted to ignore/opt-out from the edge in some specific paths because it exceeds the limit of 1MB (edge functions need to be under 1MB). And yes it is a dynamic route. I dont want to disable edge for whole website, I still use the edge run time in my API Routes and middleware. Thanks for your response MeowHeartCloudflare
6 Replies
Rahul Marban
Rahul Marban11mo ago
this is the repo if you want to reproduce. https://github.com/Rahuletto/CodeBoard -- and should note that the error asks us to use edge but nextjs on pages currently supports experimental-edge and not edge. Just a life improvement in the logs.
James
James11mo ago
I don't know what you mean here. Next.js builds your application and if you use the edge runtime for a route, it builds an edge function for it which we use. Using the old experimental-edge from before it was declared stable and changed to edge makes zero difference to us, that only affects Next.js when your website is being built by Next/Vercel. Looking at your repo, you're trying to do server-side rendering in your dynamic routes, so I'm afraid you will have to opt them into the edge runtime. If you knew what paths the dynamic routes would have, you could do SSG perhaps, but it doesn't look like that will be an option in your project
Rahul Marban
Rahul Marban11mo ago
Yes Still when I try using edge in my pages, it tells me that it's still in experimental and should be opt in with experimental-edge
James
James11mo ago
That's probably because you're using the old pages directory instead of the app directory i guess
Rahul Marban
Rahul Marban11mo ago
I guess
rugia
rugia11mo ago
Did you manage to get Pages Router working with Cloudflare Pages ?