Ah I d seen that but thought it was only
Ah I'd seen that but thought it was only related to the not-found file, they must have changed something in 13.5 because I can't see any way to build a project successfully now, with or without an error.tsx file that error happens.
8 Replies
Had the same issue some days ago, here are some things I learned:
* you need to remove
export const runtime = "edge"
from your main layout (if present) cuz it applies it globally and thus affecting not-found.tsx
and error.tsx
* you can keep the layout async
as long as it's not dynamic (it can be pre-rendered at build-time)
* in my case, I was conditionally rendering my navigation menu based on session/signedIn status. I moved the navigation to a parallel route and fixed itRouting: Parallel Routes
Simultaneously render one or more pages in the same view that can be navigated independently. A pattern for highly dynamic applications.
almost always it's tied to the main
layout.tsx
But with cloudflare pages do I not want every page to be edge runtime? Including not-found.tsx and error.tsx? Does that fix the issue?
the
error.tsx
will always be a Client Component, so it's not server renderer.
and the not-found.tsx
one is a bug, that's why the issue exists and afaik it's blocked by something upstream
for the rest of the pages, yes, you need them to specify the edge
runtimeYou only want routes to use the edge runtime if they have server functionality. If a route doesn't need to do any work on the server, it would be better to let it get prerendered at build time. This reduces bundle size, but also means it doesn't need to spend time SSRing the page at runtime (albeit minimal amount of time anyway).
Ah for my app nearly all the pages are dynamic anyway and I have logic within the root layout so need that to declare the edge runtime.
I'm happy enough on version 13.4.19 that I'd rather wait for that bug to be patched than restructure my app to move that logic out of the root layout
funny thing is that 13.4.19 is also affected, I had a project on 13.4.19 -> upgraded to 13.5.2 -> got the error -> reverted to 13.4.19 -> still got the error -> expent a whole day understanding why and finding workarounds
but if it somehow works for you that's great
cuz the issue is tied to the
vercel
pkg version used at build-timeMy issue is only with
_error.tsx
, I don't have the not-found.tsx
error in my project.
Which might be the difference