-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[bug] rendering 404 instead of /
or localized /en/
or /ru/
pages after updating gatsby from 2.15.22 to 2.15.23 or newer
#17980
Comments
/
or localized /en/
or /ru/
pages after updating gatsby from 2.15.22 to 2.15.28/
or localized /en/
or /ru/
pages after updating gatsby from 2.15.22 to 2.15.23 or newer
currently bug persists in 2.15.28 |
Do you have a GitHub of the affected project? |
I believe that you have the issue, just trying to create a reproduction. How do you have localization configured? |
@Sever1an with gatsby-node createPages api |
@Sever1an we have 2 locales at the time, en and ru. everything works perfectly up until 2.15.23. |
Are you using a plugin for internationalization or is this a completely custom solution? What happens if you remove the 404 matchpath, L113-L118? Gatsby should route to 404 anyways. |
@Sever1an this is custom solution, we are loading dictionary jsons from locize.com, and iterating on locales to create 2x pages from templates by passing locale to the context. trying your advice, will be back with answer soon |
I have not been able to recreate the bug yet, but have some observations. In the included screenshots there is a matchPath for a 404 page at
.cache/match-paths.json
Addendum: the matchpaths |
@JustFly1984 Could you take a look in |
I think that the bug here is that match paths for An add-on problem is that using this technique to supply a 404 page for a path causes that entire path to be routed with match-paths.json instead of the static page routing. Regarding the error with the 404 page, yikes! Could it be that you now have no 404 page at all or the 404 page is broken such that gatsby routes to non-existent page? |
@Sever1an I do not understand why |
If you have a lot of static content under |
@Sever1an |
@Sever1an For now I will roll back to 2.15.22 and wait till it will be fixed. I'm sure there is other people who has same issue. This is totally breaking change, and should not be published as patch version. We have e2e tests, and issue was catched, so we could track issue to gatsby update commit, so we have not pushed to production. but it is silent bug, and who knows how many people have it in production. |
It is not the expected behavior, index pages in match paths should take precedence. I was suggesting that you might have the 404 page localize its self using |
well, this is not really feasible to use props.location, cos we are using react-intl... I will wait till bug is fixed and update then. |
If the language is in the url like https://myapp.com/en/more-info, What changed with match-paths.json is that now any static page which should take precedence over a wildcard match path route now has an entry there. Using a super broad one to handle 404 will result in a bloated match-paths.json to replicate something that is already kind of built in. |
The issue seems to occur in this function: https://github.com/wardpeet/gatsby/blob/35cb2389e15438518b711812a111bf414a1ca4c4/packages/gatsby/src/bootstrap/requires-writer.js#L28-L39 Particularly this line. let score = page.matchPath.replace(/\/$/, ``).split(`/`).length Paths are assigned a score based on how specific they are by basically counting slashes, but it removes the trailing slash first. For an index page the trailing slash is significant, as it implies |
Is there any movement on issue? |
The core team has all been away for the past week, I wouldn't expect anything before Monday. I anticipate this issue will get plenty of attention. |
this part of code should be tested, so tests will fail before anything could be released |
They are pretty serious about CI and have lots of tests, it is actually surprising that they do not have one for this. Perhaps a more formal specification of paths and trailing slashes is needed to allow effective tests. There are certainly a few possibly undefined cases with stripped trailing slash like: |
is there any movement? |
Published |
It does work as expected after update! Thank you! |
Description
We have an application with internationalization support. All pages created with gatsby-node createPages api. With garsby@2.15.22 and older there is normal behavior, but after update to 2.15.23 or newer (2.15.28), root page and localized versions of the root page displaying 404 template content.
All other pages displayed correctly. If I roll back to 2.15.22 root page and localized versions displayed properly.
This incorrect behavior is consistent in development and production.
I do not have steps to reproduce, but expect other people to have same issue.
Environment
System:
OS: macOS 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-4960HQ CPU @ 2.60GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.9.0 - ~/.nvm/versions/node/v12.9.0/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.10.2 - ~/.nvm/versions/node/v12.9.0/bin/npm
Languages:
Python: 2.7.15 - /usr/local/bin/python
Browsers:
Chrome: 77.0.3865.90
Firefox: 69.0
Safari: 13.0.1
The text was updated successfully, but these errors were encountered: