next-i18next
next-i18next copied to clipboard
Incompatible with Next 12.2
Describe the bug
When I upgrade to Next 12.2 and deploy to Vercel, I have the following error:
Cannot read properties of undefined (reading '_nextI18Next')
It gets resolved as soon as I downgrade to [email protected]
Occurs in next-i18next version
11.0.0
Steps to reproduce
Just upgrade to [email protected]
and then try to access to the app, in my case I get a black screen (screenshot attached).
Expected behaviour
The page should work just like it did for [email protected]
Screenshots

Additional Info
I'm sure I'm using serverSideTranslations
inside the page that I'm trying to load.
If it works locally, have you opened an issue at next ?
I'm experiencing the same issue . I also noticed that the problem might be somehow linked to Incremental Static Regeneration : the problem vanishes after a new build and re-appear after 15 min (my page's cache is supposed to revalidate after 15 min). But I have ISR on 3 others pages with i18n-next which don't have any bug. I also linted all my .yaml looking for a special character and I didn't found anything.
"next": "^12.2.0"
"next-i18next": "^11.0.0"
"react": "^18.2.0"
"react-dom": "^18.2.0"
Cannot read properties of undefined (reading '_nextI18Next')
I upgraded to nextjs 12.2 and I also have the same error using next-i18next 8.9.0
I just upgrade next-i18next to 11.0.0 to see if corected
We have the same problem, and its somehow related to the middleware were using. Even if the middleware is just using a single next(). If there is no file, it just works fine.
Tried the next canary versions of next though and the error goes away, but with middleware there are still some strange behavior. For now the solution was rolling back the next version.
I have a similar issue with a custom middleware (for basic auth) and automatic locale redirects causing infinite redirects and at some point the website crashing because of it.
This is definitely a nextjs error, planning to set up a repro case soon
Same issue here with:
- [email protected]
- custom middleware that handle custom localization and rewrite()
Was working well in the 12.2.beta, as far as I remember.
What is the status ? Has anyone raised an issue on Next ?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Not stale.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
#1657 same error message other reason?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
FYI: We had the same issue but we managed to fix it by removing getInitialProps
in the custom App. We also have a custom middleware with redirects which was not the issue for us
next: 12.1.4 next-i18next: ^12.1.0
Same issue with: next: 12.2.0, next-i18next: 12.1.0
typeError: Cannot read properties of undefined (reading '_nextI18Next')
Same issue with
next: 12.2.0, next-i18next: 12.1.0
please provide a minimal reproducible example... seems to work here: https://github.com/i18next/next-i18next/tree/master/examples/simple
Same issue with next: 12.2.0, next-i18next: 12.1.0
please provide a minimal reproducible example... seems to work here: https://github.com/i18next/next-i18next/tree/master/examples/simple
It's not always reproducible, happening randomly while navigating between different routes.
Using getServerSideProps
can #ignore Root cause for the issue in my case https://github.com/vercel/next.js/discussions/14726