Skip to content
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

[NEXT-834] Regression in 13.2: 404 on pages with dynamic routes and i18n enabled #46841

Closed
1 task done
jleclanche opened this issue Mar 6, 2023 · 11 comments · Fixed by #47429
Closed
1 task done

[NEXT-834] Regression in 13.2: 404 on pages with dynamic routes and i18n enabled #46841

jleclanche opened this issue Mar 6, 2023 · 11 comments · Fixed by #47429
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team.

Comments

@jleclanche
Copy link
Contributor

jleclanche commented Mar 6, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: linux
      Arch: x64
      Version: #1 SMP Fri Jan 27 02:56:13 UTC 2023
    Binaries:
      Node: 16.19.1
      npm: 8.19.3
      Yarn: 1.22.19
      pnpm: N/A
    Relevant packages:
      next: 13.2.4-canary.4
      eslint-config-next: 13.2.3
      react: 18.2.0
      react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true), Routing (next/router, next/navigation, next/link)

Link to the code that reproduces this issue

To Reproduce

Use dynamic routing for URLs such as /test/[uuid]/page.tsx

Describe the Bug

This broke specifically in next@13.1.7-canary.14, as it was still working in next@13.1.7-canary.13. Currently reviewing all the commits between the two versions to see what might be causing it.

I get nothing in the logs, very mysterious.

Expected Behavior

No 404

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

NEXT-834

@jleclanche jleclanche added the bug Issue was opened via the bug report template. label Mar 6, 2023
@jleclanche
Copy link
Contributor Author

  • Removing use of params in the function doesn't fix it
  • Even a simple <div>Test</div> reproduces it
const Page = async () => {
	return <div>Test</div>;
};

export default Page;

@jleclanche
Copy link
Contributor Author

Suspicious commits:

@mdrayer
Copy link

mdrayer commented Mar 6, 2023

Hmm, I am using the latest 13.2.4-canary.4 and my dynamic pages (/app/foo/[slug]/page.tsx) are responding just fine (200 status). Any other instructions here to get the unwanted 404 behavior to happen?

@jleclanche
Copy link
Contributor Author

Currently trying to reduce my use case, because yeah I suspect there's more to it.

@jleclanche
Copy link
Contributor Author

The following is needed in next.config.js to trigger it

	i18n: {
		locales: ["en"],
		defaultLocale: "en",
	},

@jleclanche jleclanche changed the title Regression in 13.2: 404 on pages with dynamic routes Regression in 13.2: 404 on pages with dynamic routes and i18n enabled Mar 6, 2023
@jleclanche
Copy link
Contributor Author

jleclanche commented Mar 6, 2023

Minimal reproduction case.

nextjs-issue-46841.zip

Access /test/123. It should not be a 404.

  • npm install next@13.1.7-canary.13 will not reproduce
  • npm install next@13.1.7-canary.14 will reproduce
  • Removing the i18n block from the config will not reproduce in either case

@pveyes
Copy link
Contributor

pveyes commented Mar 6, 2023

this is probably duplicate of #46814

@kulikov92
Copy link

I have the same problem, dynamic routes do not work with non-default locale

@jleclanche
Copy link
Contributor Author

@pveyes yeah seems like it is.

@kespinola
Copy link

Confirming route segments don't work when have i18n enabled in next.config. for next@13.2.x

@wyattjoh wyattjoh added the linear: next Confirmed issue that is tracked by the Next.js team. label Mar 16, 2023
@timneutkens timneutkens changed the title Regression in 13.2: 404 on pages with dynamic routes and i18n enabled [NEXT-834] Regression in 13.2: 404 on pages with dynamic routes and i18n enabled Mar 16, 2023
@wyattjoh wyattjoh reopened this Mar 23, 2023
timneutkens pushed a commit that referenced this issue Mar 24, 2023
Fixes issue with app directory that caused problems with `i18n` was
enabled. Previously, when you accessed a URL like `/blog/first-issue`,
you would expect it to hit the app route at `/app/blog/[slug]/page.tsx`,
but instead it internally attempted to access
`/app/{defaultLocale}/blog/[slug]/page.tsx` (where `{defaultLocale}` is
set in `next.config.js` via `i18n.defaultLocale`). This is because while
the path did not assume the locale, the domain/default was enough to
suggest it, causing the mismatch.

This adds a new internal parameter for tracking this _default_
assignment so it can be handled by the matcher correctly.

Fixes #46814
Fixes #46841
fix NEXT-777 ([link](https://linear.app/vercel/issue/NEXT-777))
fix NEXT-834 ([link](https://linear.app/vercel/issue/NEXT-834))

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants