A way to mass opt in server to edge?
Answered
European pilchard posted this in #help-forum
European pilchardOP
Hi everyone, I want to switch from Vercel to cloud flare pages, but it says in docs that I need to opt in each individual server page to edge as node run time isn’t supported. Is there just an easy way to opt in every page without adding the line to each one? Like could I just make the route layout edge and everything under it will be edge too? Seems like that should be an option since with cloud flare specifically if you don’t opt in it doesn’t work at all. Thanks in advance! I’m using latest Next JS 14 as well.
Answered by joulev
cf pages user here. no unfortunately there are no ways to mass opt in, you have to put that export statement everywhere
8 Replies
@European pilchard Hi everyone, I want to switch from Vercel to cloud flare pages, but it says in docs that I need to opt in each individual server page to edge as node run time isn’t supported. Is there just an easy way to opt in every page without adding the line to each one? Like could I just make the route layout edge and everything under it will be edge too? Seems like that should be an option since with cloud flare specifically if you don’t opt in it doesn’t work at all. Thanks in advance! I’m using latest Next JS 14 as well.
cf pages user here. no unfortunately there are no ways to mass opt in, you have to put that export statement everywhere
Answer
@joulev cf pages user here. no unfortunately there are no ways to mass opt in, you have to put that export statement everywhere
European pilchardOP
Damn that’s pretty rough, would you say that the pricing on cloud flare is worth the switch?
@European pilchard Damn that’s pretty rough, would you say that the pricing on cloud flare is worth the switch?
i don't make the decision to use cf (i only joined after the entire infra is run on cf), though i would say yes it only comes with minor inconvenience and definitely worth the price decrease
@joulev i don't make the decision to use cf (i only joined after the entire infra is run on cf), though i would say yes it only comes with minor inconvenience and definitely worth the price decrease
European pilchardOP
Thank you, maybe I’ll just suck it up and put edge everywhere lol
American Crow
You guys sure?
https://nextjs.org/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes
You can also define runtime on a layout level, which will make all routes under the layout run on the edge runtime:https://nextjs.org/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes
It does cover a lot of places but not everywhere. A notable exception is route handlers which are not subjected to the layout so you still have to put the export everywhere. There are no global solutions – there used to be but it has been discontinued
if it's a real real real pain to add the export to files you can always script it
to add the export to each page as a codegen / pre commit step