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

Static props not working if i18n is active and catch-all-route is present in root folder #39255

Closed
1 task done
tilman opened this issue Aug 2, 2022 · 2 comments
Closed
1 task done
Labels
bug Issue was opened via the bug report template.

Comments

@tilman
Copy link

tilman commented Aug 2, 2022

Verify canary release

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

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:01 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T6000
Binaries:
  Node: 14.19.3
  npm: 6.14.17
  Yarn: 1.22.19
  pnpm: 7.5.0
Relevant packages:
  next: 12.2.4-canary.9
  eslint-config-next: 12.2.3
  react: 18.2.0
  react-dom: 18.2.0

But the Problem only occurs on the vercel platform in production and preview deployments

What browser are you using? (if relevant)

Chrome with german default language

How are you deploying your application? (if relevant)

Vercel

Describe the Bug

Could not fetch static props for index page if i18n is enabled and a [...slugs] catch all route is used in pages root directory.

By using the network inspector we can see that one version of the static props (the one which is not the default locale) get's redirected to the page instead of receiving the static props json.

Expected Behavior

All static props files should receive there content and not anything else. Therefore the wrong redirect has to be fixed.

Link to reproduction

https://github.com/trieb-work/routing-issue-example

To Reproduce

0.) Visit https://routing-issue-example-gcczuzlft-triebwork.vercel.app
1.) go to chrome network manager and disable cache to make sure no static props request is in the cache. Also start the recording and filter for XHR so you can see the static props requests
2.) visit index page with / (with german browser language settings to make sure you are not redirected to /en version)
3.) in the network manager you can see that en.json request was redirected (status 307) which is kinda strange and probably the reason why step 4.) has some problems
4.) make sure you are still on the default locale 'de' version (/ without en or de) and then click on /en button.
5.) After switch to EN version the page could not load the static props and behind Demo: no string appears. Instead it should say: Demo: static props are working (index page). Also check the console for the static props log so you can see that an empty object was received as static props.
6.) Also notice that if you directly visit the /en page everthing is working (probably because it is using the static props from the preprendered page an not from the ones which are redirected)

@tilman
Copy link
Author

tilman commented Aug 19, 2022

Seems to be resolved with #39370 and works with 12.2.6-canary.1

@tilman tilman closed this as completed Aug 19, 2022
@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 Sep 18, 2022
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.
Projects
None yet
Development

No branches or pull requests

1 participant