Open DeJayDev opened 3 months ago
I met the same issue when adding a middleware in app router, next.js expects to use experimental-edge
but the cf build tool only accepts edge
runtime
You might want to try experimenting with https://opennext.js.org/cloudflare, which has supports dynamic error pages. Would love feedback on if this solves what you're running into.
@irvinebroque that's quite exciting! looking forward to the support for middleware
next-on-pages environment related information
Description
This is a follow up to #413. I've replicated the following Next on Pages error as requested: (@dario-piotrowicz)
Reproduction
In my testing I've actually found two methods of triggering this error.
DeJayDev/error-edge-runtime-reproduction@hybrid.
not-found.tsx
file in a hybrid pages/app router project as shown at https://github.com/DeJayDev/error-edge-runtime-reproduction/commit/415665a0b21c4e495ce046f94557dd00e9007f8a will trigger this error. TheMetadata
fromlayout.tsx
is important, as it forces the layout, and thus all pages on the app router to be using the edge runtime. Thenot-found
(_error
) component cannot be nested in this case.DeJayDev/error-edge-runtime-reproduction@ssr-error
experimental-edge
, but Next on Pages needs the runtime to be defined asedge
. All I've done for this one is add the sample component with theedge
runtime rule, tripping upvercel build
.My understanding is hybrid Pages and App Router apps are the predominant case of this issue. As when using
not-found.tsx
in an App Router project with the edge runtime specified, Next on Pages correctly generates the_not-found
Edge Function. Without the edge runtime, it builds as_error.rsc.json
.My situation which required needing to entirely delete the
_error
and_not-found
pages isn't something I've been able to reproduce.Pages Deployment Method
None
Pages Deployment ID
No response
Additional Information
This title may not be great and if you need clarification on anything please ask. I'm quick to respond :)
Would you like to help?