-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Description
Preliminary Checks
- This issue is not a duplicate. Before opening a new issue, please search existing issues: https://github.com/gatsbyjs/gatsby/issues
- This issue is not a question, feature request, RFC, or anything other than a bug report directly related to Gatsby. Please post those things in GitHub Discussions: https://github.com/gatsbyjs/gatsby/discussions
Description
It seems like there is an issue with slice maps and a 404 page that would be created with createPages rather than having a 404.js file in the pages directory. My use case is similar to the one discussed here, with the 404 page context needing to be fed with graphql data.
I also decided to try the new Slice feature (which is incredible, thank you for this). Since my website is localized, I'm also using the slices attribute in createPages as described here in order to have localized slices.
However, it looks like when the 404 page is reached when redirecting to it when a page doesn't exist, the slices alias don't seem to work properly.
Reproduction Link
https://codesandbox.io/p/sandbox/admiring-lucy-cz3nm4
Steps to Reproduce
- Navigate to a non existing page (ie https://cz3nm4-8000.csb.app/awol)
- The dev 404 page should show
- Click on Preview custom 404 page
- You should get an error with the slice not existing
Expected Result
However, if you go to the 404 page https://cz3nm4-8000.csb.app/404 everything behaves properly.
Actual Result
Mapped slice is missing:
Environment
Codesandbox env:
System:
OS: Linux 5.15 Debian GNU/Linux 11 (bullseye) 11
(bullseye)
CPU: (2) x64 AMD EPYC
Shell: 5.8 - /bin/zsh
Binaries:
Node: 18.16.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.5.1 - /usr/local/bin/npm
npmPackages:
gatsby: ^5.11.0 => 5.9.1Config Flags
No response