gatsby: Error: The result of this StaticQuery could not be fetched.
Description
Trying to run gatsby dev on heroku to use as a custom preview instance. This worked very well in the past.
Gatsby dev fails with Error: The result of this StaticQuery could not be fetched.
This seems to be an issue with recent versions of gatsby (^2.18 or so, can’t be exact here), since I have an instance running fine on the same environment which shows gatsby@2.13.35 as the installed version, with npm list gatsby
.
Steps to reproduce
gatsby new test-gatsby-site
cd test-gatsby-site
- add
Procfile
withweb: gatsby develop -p $PORT -H 0.0.0.0
heroku create test-gatsby-site
heroku config:set NODE_ENV=development
heroku config:set NPM_CONFIG_PRODUCTION=false
- commit everything in git
git push heroku master
- after deploying, which goes fine, open the ap url (test-gatsby-site.herokuapp.com)
Non-working example
Actual example showing the error running at: https://gatsby-plain-test.herokuapp.com/ (give it a minute for the dyno to spin up first, if the page is taking too long too load - it’s just asleep as a free dyno)
Working example
As proof that it can work, I’ve set up another heroku instance with gatsby@2.13.35
which works just fine https://gatsby-plain-testt.herokuapp.com/
The only thing I did was to downgrade the gatsby and corresponding packages versions (react, react-dom, etc)
Expected result
The index page should render.
Actual result
console shows 3 sets of this type of error, originating from:
index.js:2177 The above error occurred in the <Layout> component:
in Layout (at pages/index.js:9)
in IndexPage (created by HotExportedIndexPage)
in AppContainer (created by HotExportedIndexPage)
in HotExportedIndexPage (created by PageRenderer)
in PageRenderer (at query-result-store.js:86)
in PageQueryStore (at root.js:51)
in RouteHandler (at root.js:73)
in div (created by FocusHandlerImpl)
in FocusHandlerImpl (created by Context.Consumer)
in FocusHandler (created by RouterImpl)
in RouterImpl (created by Context.Consumer)
in Location (created by Context.Consumer)
in Router (created by EnsureResources)
in ScrollContext (at root.js:64)
in RouteUpdates (at root.js:63)
in EnsureResources (at root.js:61)
in LocationHandler (at root.js:119)
in LocationProvider (created by Context.Consumer)
in Location (at root.js:118)
in Root (at root.js:127)
in StaticQueryStore (at root.js:133)
in _default (at app.js:67)
index.js:2177 The above error occurred in the <AppContainer> component:
in AppContainer (created by HotExportedIndexPage)
in HotExportedIndexPage (created by PageRenderer)
in PageRenderer (at query-result-store.js:86)
in PageQueryStore (at root.js:51)
in RouteHandler (at root.js:73)
in div (created by FocusHandlerImpl)
in FocusHandlerImpl (created by Context.Consumer)
in FocusHandler (created by RouterImpl)
in RouterImpl (created by Context.Consumer)
in Location (created by Context.Consumer)
in Router (created by EnsureResources)
in ScrollContext (at root.js:64)
in RouteUpdates (at root.js:63)
in EnsureResources (at root.js:61)
in LocationHandler (at root.js:119)
in LocationProvider (created by Context.Consumer)
in Location (at root.js:118)
in Root (at root.js:127)
in StaticQueryStore (at root.js:133)
in _default (at app.js:67)
The above error occurred in the <LocationProvider> component:
in LocationProvider (created by Context.Consumer)
in Location (at root.js:118)
in Root (at root.js:127)
in StaticQueryStore (at root.js:133)
in _default (at app.js:67)
Environment
Run gatsby info --clipboard
Non-Working example (https://gatsby-plain-test.herokuapp.com/ ) env info:
System:
OS: Linux 4.4 Ubuntu 18.04.3 LTS (Bionic Beaver)
CPU: (8) x64 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
Shell: 4.4.20 - /bin/bash
Binaries:
Node: 12.16.0 - ~/.heroku/node/bin/node
Yarn: 1.22.0 - ~/.heroku/yarn/bin/yarn
npm: 6.13.4 - ~/.heroku/node/bin/npm
Languages:
Python: 2.7.17 - /usr/bin/python
npmPackages:
gatsby: ^2.19.7 => 2.19.7
gatsby-image: ^2.2.39 => 2.2.39
gatsby-plugin-react-helmet: ^3.1.21 => 3.1.21
gatsby-plugin-sharp: ^2.4.3 => 2.4.3
gatsby-source-filesystem: ^2.1.46 => 2.1.46
gatsby-transformer-sharp: ^2.3.13 => 2.3.13
Also react:
"react": "^16.12.0",
"react-dom": "^16.12.0",
Working example (https://gatsby-plain-testt.herokuapp.com/ ) env info
System:
OS: Linux 4.4 Ubuntu 18.04.3 LTS (Bionic Beaver)
CPU: (8) x64 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
Shell: 4.4.20 - /bin/bash
Binaries:
Node: 12.16.0 - ~/.heroku/node/bin/node
npm: 6.13.4 - ~/.heroku/node/bin/npm
Languages:
Python: 2.7.17 - /usr/bin/python
npmPackages:
gatsby: 2.13.35 => 2.13.35
gatsby-image: ^2.0.41 => 2.2.40
gatsby-plugin-react-helmet: ^3.0.12 => 3.1.22
gatsby-plugin-sharp: ^2.3.2 => 2.4.5
gatsby-source-filesystem: ^2.1.38 => 2.1.48
gatsby-transformer-sharp: ^2.3.5 => 2.3.14
Also react:
"react": "^16.8.6",
"react-dom": "^16.8.6",
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 28 (10 by maintainers)
This is getting a serious issue!
I pushed a commit to GitHub today just doing some changes to readme and nothing else. And my production broke showing a white screen to all users.
It still shows the same error message:
But don’t know:
Also I mentioned about this on yet another closed issue yesterday, #13764 .
I hope this gets some attention.
Edit1: I’m deploying via Vercel.
Edit 2: Live demo link (https://wirescript-n8hi8iya9.vercel.app/).
Check console in dev tools
This is the preview link for the readme update commit I talked about above. But now it works after doing a re-deployment.
It should be reproducible by exactly the steps OP has described. Last tested it around 7 days ago and that issue still exists. However, please keep in mind that this issue only appears on Heroku.
Hey there! This is still an issue. It’s also worth noting that this approach is specifically recommended in the Gatsby docs on how to run a custom preview instance on Heroku, so I really think this should be looked into.
The following reproduction is a simple Gatsby starter (
gatsby-starter-hello-world
) with a static query forsiteMetadata
and aProcfile
for Heroku.Here’s the reproduction: https://github.com/woodwoerk/heroku-gatsby-dev-bug-repro.git
@freiksenet @LekoArts could this please be reopened? ❤️
I can also confirm this bug