-
-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
notFound()
behaviour
#938
Comments
In the Middelware - Additonal Rewrites docs, it uses the following snippet. const [, locale, ...segments] = request.nextUrl.pathname.split('/'); However, the locale is not available on initial visit for example when visiting - http://dev.localhost:3000. The result is: { locale: '', segments: [] } |
Hey @amannn, any ideas on this? |
Hey @kevinmitch14, as far as I can tell, there are primarily two issues in your example app:
I've fixed your example here: https://github.com/amannn/kevinmitch14-next-intl-bug-repro-app-router. Please see the most recent commits for reference. I initially got the example working with Note that if you add additional rewrites on top of the middleware to remove the tenant, the navigation APIs will not be applicable—so you'll have to implement those yourself. Generally, this is closely related: #653. If integrating with the I'll close this issue as the fixed example seems to work as expected and because this is rather a usage question. Hope this helps! |
Hey @amannn thanks for your response, greatly appreciated. I will look into this today and report any findings! |
Description
notFound()
, I get the error messageNotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
not-found.tsx
inside[locale]
.For reference my setup looks like this:
When I put
not-found.tsx
inside[locale]
, along with alayout.tsx
, nothing happens.I actually need to place the
not-found.tsx
inside[tenant]
in order for it to trigger correctly. Is this the expected behavior? It would be great to understand what exactly is going on here!It feels a bit unnatural, I just want to use Next.js default behaviour, i18n is not a product requirement for 404 pages.
To give a little more context which is also in the repo. We are using rewrites to handle a multi tenant application, each tenant lives on a subdomain. So we are doing something like below.
When hooking this up with
createIntlMiddleware()
, it seems to also cause some issues. Logging the path from the incoming middleware request looks like this, it just keeps growing in an infinite loop of sorts. When I uselocalePrefix: "never"
, I don't get this issue however.Mandatory reproduction URL
https://github.com/kevinmitch14/next-intl-bug-repro-app-router.git
Reproduction description
Steps to reproduce:
notFound()
createIntlMiddleware()
, removelocalePrefix: "never"
and observe behaviour.Expected behaviour
No need for a custom not-found.tsx.
The text was updated successfully, but these errors were encountered: