nextjs - 💡(How to fix) Fix Broken Homepage when using App Router + Middleware + i18n config + trailingSlash config [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#84371Fetched 2026-04-08 02:19:41
View on GitHub
Comments
2
Participants
2
Timeline
11
Reactions
6
Author
Participants
Timeline (top)
labeled ×6commented ×2issue_type_added ×1mentioned ×1

Error Message

inject.bundle.js:1 Uncaught Error: Automatic publicPath is not supported in this browser at inject.bundle.js:1:12813 at inject.bundle.js:1:12976 at inject.bundle.js:1:271814 (anonymous) @ inject.bundle.js:1 (anonymous) @ inject.bundle.js:1 (anonymous) @ inject.bundle.js:1

Fix Action

Fix / Workaround

When it breaks with a white screen on home page, you can see that it breaks "immediately", you don't even go through the middleware where you would like to try to patch something 😬

Code Example

127.0.0.1 www.dev.fr www.dev.es www.dev.it www.dev.de www.dev.ch www.dev.nl

---

inject.bundle.js:1 Uncaught Error: Automatic publicPath is not supported in this browser
    at inject.bundle.js:1:12813
    at inject.bundle.js:1:12976
    at inject.bundle.js:1:271814
  (anonymous)	@	inject.bundle.js:1
  (anonymous)	@	inject.bundle.js:1
  (anonymous)	@	inject.bundle.js:1

---

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Mon Aug 25 21:17:54 PDT 2025; root:xnu-12377.1.9~3/RELEASE_ARM64_T6041
  Available memory (MB): 49152
  Available CPU cores: 12
Binaries:
  Node: 22.14.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 15.5.4 // Latest available version is detected (15.5.4).
  eslint-config-next: N/A
  react: 19.1.1
  react-dom: 19.1.1
  typescript: 5.9.2
Next.js Config:
  output: 22.14.0
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/heymath/nextjs-bug-homepage-i18n-trailingslash-middleware

To Reproduce

📝 Add dev domains in your /etc/hosts file:

127.0.0.1 www.dev.fr www.dev.es www.dev.it www.dev.de www.dev.ch www.dev.nl

  • Go to: http://www.dev.fr
  • See broken homepage (white screen) with logs:
    inject.bundle.js:1 Uncaught Error: Automatic publicPath is not supported in this browser
      at inject.bundle.js:1:12813
      at inject.bundle.js:1:12976
      at inject.bundle.js:1:271814
    (anonymous)	@	inject.bundle.js:1
    (anonymous)	@	inject.bundle.js:1
    (anonymous)	@	inject.bundle.js:1

You can test the following cases:

Middleware

(revert any changes)

Trailing slash

(revert any changes)

i18n config

(revert any changes)

When it breaks with a white screen on home page, you can see that it breaks "immediately", you don't even go through the middleware where you would like to try to patch something 😬

Current vs. Expected behavior

Current behavior: white screen with error logs on homepage

Expected behavior: homepage working correctly

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Mon Aug 25 21:17:54 PDT 2025; root:xnu-12377.1.9~3/RELEASE_ARM64_T6041
  Available memory (MB): 49152
  Available CPU cores: 12
Binaries:
  Node: 22.14.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 15.5.4 // Latest available version is detected (15.5.4).
  eslint-config-next: N/A
  react: 19.1.1
  react-dom: 19.1.1
  typescript: 5.9.2
Next.js Config:
  output: 22.14.0

Which area(s) are affected? (Select all that apply)

Middleware, Internationalization (i18n), Not Found, Route Handlers, Runtime

Which stage(s) are affected? (Select all that apply)

next dev (local), next start (local)

Additional context

We are migrating the homepage of our website to be routed to our Next.js server, but when developing it in local environment we have a broken homepage with a white screen.

We were very confused to have a routing issue with the homepage which seems the easiest one.

So we started a new repo to try to reproduce our problem. And it seems that this problem appears when you use the App Router with a i18n config + a middleware + the trailingSlash config.

We are using Docker, we have pages running on the Pages Router, API routes, etc. but as you can see in the bug reproduction repository, it does not matter, a minimal config already breaks the homepage.

<sub>NEXT-4735</sub>

extent analysis

TL;DR

The issue can likely be resolved by adjusting the configuration of next.config.ts, specifically the i18n and trailingSlash settings, or by modifying the middleware to accommodate the App Router.

Guidance

  • Verify that the issue is indeed caused by the combination of i18n config, middleware, and trailingSlash config by testing each component individually, as described in the issue reproduction steps.
  • Attempt to resolve the issue by commenting out the i18n config or setting trailingSlash to false in next.config.ts, and then refresh the homepage to see if it works as expected.
  • If the above steps do not resolve the issue, try modifying the middleware to handle the App Router correctly, potentially by adding custom logic to handle the homepage route.
  • Test the changes in a local development environment before deploying to production.

Example

No specific code example is provided, as the issue seems to be related to the configuration and interaction between different Next.js features, rather than a specific code snippet.

Notes

The issue appears to be specific to the combination of App Router, i18n config, middleware, and trailingSlash config, and may not be applicable to all Next.js projects. Further testing and debugging may be necessary to determine the root cause and find a suitable solution.

Recommendation

Apply a workaround by adjusting the next.config.ts settings, such as commenting out the i18n config or setting trailingSlash to false, to resolve the issue temporarily while a more permanent solution is found.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING