Closed mertafor closed 9 months ago
Same problem here and not production-grade-fix. I tried a lot of workarounds like importing a layout in other layout, reading pathnames but any of these are good options to a production environment. Next team any estimates for this bug?
Any news on this?
Same issue here. Always happens when [lang] is in use.
Same issue here.
It's really disappointing that there is no response from any maintainer or contributor after more than a month passed since I posted this issue. I tried almost anything comes to mind including creating not-found.tsx
and error.tsx
in /app/[lang]
but no avail.
I believe the reason of this issue comes from this PR: https://github.com/vercel/next.js/pull/54199
It suggests adding a not-found.tsx
under app folder which won't work if [lang] is being used.
Probably the worst, I see a white screen on browser if there is a breaking JS error: Application error: a client-side exception has occurred (see the browser console for more information).
Error boundary doesn't work at all. It's a bad practice for production.
I had exactly the same error, I followed what this thread suggested, and after removing global-error.tsx
it compiled without any issue.
I hope this will help you!
Deleting global-error.tsx
also means not being able to apply root layout to the root error, which is uhhhh the whole point of app
folder.
The thing is actually global-error.tsx works just fine under /app/[lang] folder. I tried causing server errors manually and it catches all on dev environment. Only problem looks like the build error during static render checks and global-error.tsx is the only suspect here since deleting it fixes the build issues. That's said, although it's related to global-error.tsx, the main issue seems like build process.
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Link to the code that reproduces this issue
https://github.com/mertafor/next-error-template-issue
To Reproduce
1 - Run pnpm build 2 - Build process fails by throwing following error :
Current vs. Expected behavior
Unfortunately default pages like not-found and global-error pages are not well planned for internationalization, or at least I'd say it's not very well explained in docs. Either I'm doing something wrong or it's a buggy behavior on Next's side.
It's recommended to create
not-found.tsx
andglobal-error.tsx
directly inside of app folder. However, inserting these files to app folder won't work becauselayout.tsx
is insideapp/[lang]
folder instead. As you can see in the minimal repo I provided, I've been able to fix this problem by creating a[...not-found]
folder to catch any 404 error. Alsoglobal-error.tsx
is being used to catch any other server error such as 500 and was used to work inapp/[lang]
folder safely. However recent releases don't allow this.Now, when I use
global-error.tsx
inside of app folder, I get a build error. It's gone when I delete it. That said, right now I have no option to catch global errors and fallback page will be Next's default error page. Also I'm hoping an official solution for working withnot-found.tsx
page directly instead of[...not-found]
workaround.This issue started after v13.4.20-canary.12 :
Verify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
App Router
Additional context
It works fine with any version before v13.4.20-canary.12
NEXT-1749