next-international
next-international copied to clipboard
Custom 404 page
Describe the bug My custom not-found.tsx page with [locale] route not working. is there any solution for it?!
To Reproduce easy to reproduce
Expected behaviour Have a custom 404 page with localization.
About (please complete the following information): "next-international": "^1.1.3", "next": "14.0.1",
My custom not-found.tsx page with [locale] route not working.
Could you be more precise?
easy to reproduce
Please provide a minimal reproduction. I tried by adding a not-found.tsx
file inside /app
and it works fine:
My custom not-found.tsx page with [locale] route not working.
Could you be more precise?
easy to reproduce
Please provide a minimal reproduction. I tried adding a
not-found.tsx
file inside/app
and it works fine:![]()
Sorry for not being precise enough.
this is my file structure:
when I move not-found.tsx in the app folder it says the 404 page must be near the Layout.tsx file and also can't move Layout.tsx to the app because I wanna use localization features in there and must be under [locale] route.
it says the 404 page must be near the Layout.tsx file
I'm not sure to understand what you mean. What's saying that?
See this sandbox, where I'm not able to reproduce the issue: https://codesandbox.io/p/sandbox/next-international-app-router-forked-tgcmh3?file=%2Fapp%2Fnot-found.tsx%3A8%2C1&layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clp14xalv000b3b6enow4bn7j%2522%252C%2522sizes%2522%253A%255B70%252C30%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clp14xalv00033b6eozujgqmu%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clp14xalv00083b6evkkny04c%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clp14xalv000a3b6ey1mvp5pq%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clp14xalv00033b6eozujgqmu%2522%253A%257B%2522id%2522%253A%2522clp14xalv00033b6eozujgqmu%2522%252C%2522activeTabId%2522%253A%2522clp15g4gs01j23b6ej7qsg8zd%2522%252C%2522tabs%2522%253A%255B%257B%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Fapp%252F%255Blocale%255D%252Fheader.tsx%2522%252C%2522id%2522%253A%2522clp15es5600rw3b6e5272vlem%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%252C%257B%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Fapp%252F%255Blocale%255D%252Flayout.tsx%2522%252C%2522id%2522%253A%2522clp15frfs01dq3b6eqyepvvok%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%252C%257B%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Fapp%252Fnot-found.tsx%2522%252C%2522id%2522%253A%2522clp15g4gs01j23b6ej7qsg8zd%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%257D%252C%2522clp14xalv000a3b6ey1mvp5pq%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clp14xalv00093b6ebftzqduu%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_PORT%2522%252C%2522taskId%2522%253A%2522dev%2522%252C%2522port%2522%253A3000%252C%2522path%2522%253A%2522%252Fen%252Fjhrazkjhr%2522%257D%255D%252C%2522id%2522%253A%2522clp14xalv000a3b6ey1mvp5pq%2522%252C%2522activeTabId%2522%253A%2522clp14xalv00093b6ebftzqduu%2522%257D%252C%2522clp14xalv00083b6evkkny04c%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clp14xalv00043b6e6satngx0%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522dev%2522%257D%252C%257B%2522id%2522%253A%2522clp14xalv00053b6eqdr1jusu%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522build%2522%257D%252C%257B%2522id%2522%253A%2522clp14xalv00063b6ec74tezsq%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522start%2522%257D%252C%257B%2522id%2522%253A%2522clp14xalv00073b6esjb29vcm%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522lint%2522%257D%255D%252C%2522id%2522%253A%2522clp14xalv00083b6evkkny04c%2522%252C%2522activeTabId%2522%253A%2522clp14xalv00043b6e6satngx0%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D
It says the 404 page must be near the Layout.tsx file
I'm not sure to understand what you mean. What's saying that?
See this sandbox, where I'm not able to reproduce the issue: Sandbox Link
this is my folder structure right now.
This is the error I get now.
I also matched my next and next-international version with your sandbox project but the issue is still there.
Please share a minimal reproduction - as you've seen, I'm not able to reproduce the issue and I can't determine what's causing it without the code to reproduce it.
@QuiiBz The link you provided gives me the same error OP described.
Im also encounteing this error on my project
I added a working example of a notFound page within the [locale]
folder in my repro of the issue #298 to help with this issue.
You can find it here: [...notFound]/page.tsx
This not found page is working even though I still have my issue with the global not-found file when built.
Sorry for the delay, I started a new job. We're having the same issue with typehero, but this isn't a bug with next-international. The issue is with how Next.js handles 404 pages with dynamic params.
Resolution here: https://github.com/QuiiBz/next-international/issues/357#issuecomment-1947048161