Next-i18next: 404 with localeSubpaths

Created on 6 Aug 2020  路  16Comments  路  Source: isaachinman/next-i18next

Describe the bug

I get a 404 with localeSubpaths only on production build. In develop everthing works fine.

Occurs in next-i18next version

v6.0.2

Steps to reproduce

I get no error so i have no clue

Expected behaviour

http://localhost:3000/en -> statusCode 200 and not 404

OS (please complete the following information)

  • Browser: Chrome: 84.0.4147.105

Additional context

  • next.js v9.5.1

I will try to submit a reproducible repo.

Most helpful comment

@gpessa and @Uniiq you will need to provide a reproducible repository if you would like help debugging.

All 16 comments

Let me know when you put together a reproducible repo, and I'll have a look.

Got the same problem. Reproducible Repo: https://github.com/michelalbers/next-i18next-404

@michelalbers Couple issues with that repo regarding your TS setup. Regardless, I was able to run the app via yarn build && yarn start, and can not see any 404 errors. Can you provide specific instructions as to how I can reproduce the error?

Try yarn dev :)

Running with yarn dev does not produce any 404s for me either.

I have the feeling it doesn鈥檛 work when u didn鈥檛 run next build initially. Will confirm when I鈥檓 back at the office.

I did a fresh clone of the repo, and then just did yarn && yarn dev. I had to install TS deps because they were not present. I did not run yarn build.

Figured it out ... I had next.js 9.4.4 in my cache which does not support rewrites. Next.js 9.5 is required which came out 11 days ago. Could we add that to the readme?

@mweibel How did you fix it exactly? How can i clean the cache?

How did you fix it exactly? How can i clean the cache?

In my case it was as simple as yarn add next@^9.5.0

Well, it's in the package.json, and you would have been receiving warnings from npm or yarn. Not sure it's worth adding to docs.

I still get a 404

Well, it's in the package.json, and you would have been receiving warnings from npm or yarn. Not sure it's worth adding to docs.

Yes you get a peer dependecy warning ... but in every bigger project you might have quite a few from them. Anyway - my issue is resolved. Thank you very much @isaachinman

@gpessa and @Uniiq you will need to provide a reproducible repository if you would like help debugging.

@isaachinman i sry for the late response. The first problem was i forgot to remove await nextI18next.initPromise; from custom next server file (i upgraded from [email protected] ).The second problem is i use cacheable-response to cache the SSR response and somehow next-i18next interfere with my caching function and redirect me to 404 error page (caching is only enabled on production).

In short there is a bug on my side. :)

@isaachinman i sry for the late response. The first problem was i forgot to remove await nextI18next.initPromise; from custom next server file (i upgraded from [email protected] ).The second problem is i use cacheable-response to cache the SSR response and somehow next-i18next interfere with my caching function and redirect me to 404 error page (caching is only enabled on production).

@Uniiq sorry! what is the solution for this bug? This only happens in production mode. What should I do? Some help please?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

romaincointepas picture romaincointepas  路  6Comments

revskill10 picture revskill10  路  5Comments

ronfogel picture ronfogel  路  3Comments

slava-lu picture slava-lu  路  6Comments

dohomi picture dohomi  路  5Comments