vercel / vercel/next.js

I18n configuration in next.config.js breaks app directory

Open
#53,724 49 comments 37 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Internationalization (i18n) linear: next
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Verify canary release
  • I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
      Platform: darwin
      Arch: x64
      Version: Darwin Kernel Version 22.6.0: Wed Jul  5 22:21:56 PDT 2023; root:xnu-8796.141.3~6/RELEASE_X86_64
    Binaries:
      Node: 20.5.0
      npm: 9.8.0
      Yarn: 3.5.0
      pnpm: 8.6.12
    Relevant Packages:
      next: 13.4.14-canary.0
      eslint-config-next: 13.4.13
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.1.6
    Next.js Config:
      output: N/A
Which area(s) of Next.js are affected? (leave empty if unsure)

App Router, Internationalization (i18n), Routing (next/router, next/navigation, next/link)

Link to the code that reproduces this issue or a replay of the bug

https://github.com/fabio-nettis/next-i18n-error

To Reproduce

This issue is directly related to my previous issue #53665 You can find more about the discovery process of this bug in this discussion.

  1. Clone the repository
  2. Try to navigate to any of the defined pages
  3. You will encounter a not found error for each of the defined routes.

Once you have seen the error you can then do the following steps to revert the broken app folder:

  1. Remove i18n key from next config
  2. Try to navigate to any of the defined pages
  3. See the defined page
Describe the Bug

Since version 13.4.13-canary.0 an application previously working fine on version 13.4.12 returns a 404 status code for every page in the app folder when the i18n setting is set in the next config file.

Expected Behavior

Setting the i18n in the next config file should not break the whole application' routing.

Which browser are you using? (if relevant)

Chrome 114.0.5735.106 (Official Build) (x86_64)

How are you deploying your application? (if relevant)

next dev

NEXT-1512

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Clone the linked reproduction and run it with next dev, first with the i18n key in next.config.js and then with that key removed. Trace how the App Router handles the configuration and routes in the app folder. Done means the defined pages no longer return 404 responses when i18n is configured.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, react
Domain
frontend, internationalization, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.