gatsby: Prefetch header with request /page-data//page-data.json giving 404
Description
I’m getting 404 for prefetch request /page-data//page-data.json . This is server side generated prefetch header. Not sure where is this double slash coming from, possibly something is missing between these 2 slashes…
I’ve index.js inside src/pages/ folder.
These are the headers… see the prefetch header in second last line below…
<link as="script" rel="preload" href="/commons-2c9fa17bbfe249a3b2aa.js">
<link as="script" rel="preload" href="/app-ba96dfa6db2f113437ba.js">
<link as="script" rel="preload" href="/webpack-runtime-fe18612f865ab4668483.js">
<link as="fetch" rel="preload" href="/page-data/index/page-data.json" crossorigin="anonymous">
<link rel="prefetch" href="/page-data//page-data.json" crossorigin="anonymous" as="fetch">
<script charset="utf-8" src="/component---src-pages-404-js-618c1a666ce570d61585.js">
Environment
System: OS: Windows 10 CPU: (4) x64 Intel® Core™ i5-2400S CPU @ 2.50GHz Binaries: Yarn: 1.16.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 6.7.0 - E:\Program Files\nodejs\npm.CMD Browsers: Edge: 44.18362.329.0 npmPackages: gatsby: ^2.18.11 => 2.18.11 gatsby-plugin-manifest: ^2.2.26 => 2.2.30 gatsby-plugin-react-helmet: ^3.1.18 => 3.1.18 gatsby-plugin-remove-generator: ^1.0.4 => 1.0.4 gatsby-plugin-robots-txt: ^1.5.0 => 1.5.0 gatsby-plugin-sass: ^2.1.20 => 2.1.24 gatsby-plugin-sitemap: ^2.2.24 => 2.2.24 gatsby-source-graphql: ^2.1.25 => 2.1.25
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 3
- Comments: 19 (5 by maintainers)
I am experiencing the same issue and looking for a solution that works
This problem may be due to incorrect usage of Gatsby’s
<Link>
component: to use this component to in-route navigation.If you use this component for external link, similar issue will occurs.
Use
a
tag for in-route navigation or external link.For more information, check the Gatsby Link API documentation.
Sorry to hear you’re running into an issue. To help us best begin debugging the underlying cause, it is incredibly helpful if you’re able to create a minimal reproduction. This is a simplified example of the issue that makes it clear and obvious what the issue is and how we can begin to debug it.
If you’re up for it, we’d very much appreciate if you could provide a minimal reproduction and we’ll be able to take another look.
Thanks for using Gatsby! 💜
I also get this error on console. I think its related.
Error loading a result for the page query in "". Query was not run and no cached result was found.