Gatsby: Error: The result of this StaticQuery could not be fetched.

Created on 15 Jun 2020  路  6Comments  路  Source: gatsbyjs/gatsby

Description

cant fetch from useStaticQuery(graphql)

Steps to reproduce

my code: https://github.com/97krihop/pizza-345

Expected result

can get data from graphql layer and post it

Actual result

image

Environment

System:
OS: Windows 10 10.0.18363
CPU: (12) x64 Intel(R) Core(TM) i7-10710U CPU @ 1.10GHz
Binaries:
Node: 14.4.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.4 - ~\AppData\Roaming\npm\yarn.CMD
npm: 6.14.5 - C:\Program Files\nodejs\npm.CMD
Languages:
Python: 3.8.3 - /c/Python38/python
Browsers:
Edge: 44.18362.449.0
npmPackages:
gatsby: ^2.23.1 => 2.23.3
gatsby-plugin-sass: ^2.3.3 => 2.3.4
gatsby-source-filesystem: ^2.3.10 => 2.3.11
gatsby-transformer-json: ^2.4.4 => 2.4.5
gatsby-transformer-remark: ^2.8.14 => 2.8.15
npmGlobalPackages:
gatsby-cli: 2.12.44

bug

Most helpful comment

This is very strange, I swapped the imports and the error disappeared
import { graphql, useStaticQuery } from 'gatsby' --> import { useStaticQuery, graphql } from 'gatsby'

All 6 comments

Experiencing the same issue

System:
OS: macOS 10.15.4
CPU: (4) x64 Intel(R) Core(TM) i7-4558U CPU @ 2.80GHz
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.9.1 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.12.0 - /usr/local/bin/npm
Languages:
Python: 2.7.16 - /usr/bin/python
Browsers:
Chrome: 83.0.4103.97
Safari: 13.1
npmPackages:
gatsby: ^2.23.3 => 2.23.3
gatsby-image: ^2.4.7 => 2.4.7
gatsby-plugin-anchor-links: ^1.1.1 => 1.1.1
gatsby-plugin-compile-es6-packages: ^1.1.0 => 1.2.0
gatsby-plugin-eslint: ^2.0.5 => 2.0.8
gatsby-plugin-google-tagmanager: ^2.3.5 => 2.3.5
gatsby-plugin-hubspot: ^1.3.3 => 1.3.3
gatsby-plugin-manifest: ^2.4.11 => 2.4.11
gatsby-plugin-offline: ^2.2.0 => 2.2.10
gatsby-plugin-page-creator: ^2.3.9 => 2.3.9
gatsby-plugin-react-helmet: ^3.3.4 => 3.3.4
gatsby-plugin-react-helmet-canonical-urls: ^1.2.0 => 1.4.0
gatsby-plugin-robots-txt: ^1.5.1 => 1.5.1
gatsby-plugin-sharp: ^2.6.11 => 2.6.11
gatsby-plugin-sitemap: ^2.4.5 => 2.4.5
gatsby-plugin-smoothscroll: ^1.1.0 => 1.1.0
gatsby-plugin-styled-components: ^3.3.4 => 3.3.4
gatsby-plugin-webpack-bundle-analyser-v2: ^1.1.10 => 1.1.10
gatsby-source-datocms: ^2.2.6 => 2.2.6
gatsby-source-filesystem: ^2.3.11 => 2.3.11
gatsby-transformer-react-docgen: ^5.2.5 => 5.2.5
gatsby-transformer-sharp: ^2.5.5 => 2.5.5
npmGlobalPackages:
gatsby-cli: 2.12.43

same. I was working with css styles, not touching any files with a StaticQuery. Re-building was going fine, until it wasn't. Running npx gatsby develop left me hanging on the new loading screen for Gatsby but the bundle wouldn't finish building. npx gatsby clean did not help so I rm -rf node_modules && npm i and I uploaded npm from 6.14.4 to 6.14.5, and the change now is that the building appears to complete successfully but the server leaves me hanging in the browser with the message in chrome : "waiting for available socket". I restarted the development server and now the message is "waiting for localhost"..

System:
OS: macOS 10.15.4
CPU: (4) x64 Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 14.4.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.5 - /usr/local/bin/npm
Languages:
Python: 3.8.1 - /Users/cog/.pyenv/shims/python
Browsers:
Chrome: 83.0.4103.97
Firefox: 77.0.1
Safari: 13.1
npmPackages:
gatsby: ^2.23.3 => 2.23.3
gatsby-image: ^2.4.7 => 2.4.7
gatsby-plugin-feed: ^2.5.5 => 2.5.5
gatsby-plugin-google-analytics: ^2.3.4 => 2.3.4
gatsby-plugin-manifest: ^2.4.11 => 2.4.11
gatsby-plugin-offline: ^3.2.9 => 3.2.9
gatsby-plugin-react-helmet: ^3.3.4 => 3.3.4
gatsby-plugin-react-svg: ^3.0.0 => 3.0.0
gatsby-plugin-sharp: ^2.6.11 => 2.6.11
gatsby-plugin-styled-components: ^3.3.4 => 3.3.4
gatsby-plugin-typography: ^2.5.4 => 2.5.4
gatsby-remark-copy-linked-files: ^2.3.5 => 2.3.5
gatsby-remark-images: ^3.3.10 => 3.3.10
gatsby-remark-prismjs: ^3.5.4 => 3.5.4
gatsby-remark-responsive-iframe: ^2.4.5 => 2.4.5
gatsby-remark-smartypants: ^2.3.4 => 2.3.4
gatsby-source-filesystem: ^2.3.11 => 2.3.11
gatsby-transformer-remark: ^2.8.15 => 2.8.15
gatsby-transformer-sharp: ^2.5.5 => 2.5.5

I went to chrome://net-internals/#sockets and clicked on 'Flush socket pools' and I'm up and running again.

I have the same

System:
OS: macOS 10.15.5
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 13.14.0 - ~/.nvm/versions/node/v13.14.0/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.5 - ~/.nvm/versions/node/v13.14.0/bin/npm
Languages:
Python: 2.7.16 - /usr/bin/python
Browsers:
Chrome: 83.0.4103.97
Firefox: 77.0.1
Safari: 13.1.1
npmPackages:
gatsby: 2.23.3 => 2.23.3
gatsby-background-image: ^1.1.1 => 1.1.1
gatsby-cli: 2.12.45 => 2.12.45
gatsby-image: 2.4.7 => 2.4.7
gatsby-plugin-purgecss: ^5.0.0 => 5.0.0
gatsby-plugin-react-helmet: ^3.3.4 => 3.3.4
gatsby-plugin-robots-txt: ^1.5.1 => 1.5.1
gatsby-plugin-rollbar: ^1.1.0 => 1.1.0
gatsby-plugin-sharp: 2.6.11 => 2.6.11
gatsby-plugin-sitemap: ^2.4.5 => 2.4.5
gatsby-plugin-stylus: ^2.3.4 => 2.3.4
gatsby-plugin-typescript: ^2.4.6 => 2.4.6
gatsby-source-contentful: 2.3.15 => 2.3.15
gatsby-transformer-remark: ^2.8.15 => 2.8.15
gatsby-transformer-sharp: 2.5.5 => 2.5.5

This is very strange, I swapped the imports and the error disappeared
import { graphql, useStaticQuery } from 'gatsby' --> import { useStaticQuery, graphql } from 'gatsby'

The same thing was posted a few days ago, so it's best to post there but it seems that 2.23.3 is a problematic build

Was this page helpful?
0 / 5 - 0 ratings