Skip to content
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

Uncaught Error: The result of this StaticQuery could not be fetched. #26563

Closed
jack0wsky opened this issue Aug 20, 2020 · 83 comments
Closed

Uncaught Error: The result of this StaticQuery could not be fetched. #26563

jack0wsky opened this issue Aug 20, 2020 · 83 comments
Labels
topic: GraphQL Related to Gatsby's GraphQL layer type: bug An issue or pull request relating to a bug in Gatsby

Comments

@jack0wsky
Copy link

jack0wsky commented Aug 20, 2020

Description

I have deployed site through Vercel and I'm facing following error.

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

This is likely a bug in Gatsby and if refreshing the page does not fix it, please open an issue in https://github.com/gatsbyjs/gatsby/issues
    at h (gatsby-browser-entry.js:77)
    at e.default (products.js:15)
    at Ki (react-dom.production.min.js:153)
    at Fa (react-dom.production.min.js:175)
    at vo (react-dom.production.min.js:263)
    at cu (react-dom.production.min.js:246)
    at ou (react-dom.production.min.js:246)
    at Zo (react-dom.production.min.js:239)
    at react-dom.production.min.js:123
    at KqkS.t.unstable_runWithPriority (scheduler.production.min.js:19)

Error shows when I click on Products page or even Contact page where isn't static query declared. This error didn't exist while developing. Here's products.js file:

import { useStaticQuery, graphql } from 'gatsby'
import Product from '../components/product/product'

const Products = () => {
  const {
    allShopifyProduct: { edges },
  } = useStaticQuery(graphql`
    query Products {
      allShopifyProduct {
        edges {
          node {
            title
            productType
            shopifyId
            handle
            images {
              id
              localFile {
                childImageSharp {
                  fluid {
                    srcWebp
                    tracedSVG
                    base64
                    srcSetWebp
                  }
                  fixed {
                    src
                  }
                }
              }
            }
            variants {
              sku
              price
              title
              shopifyId
            }
          }
        }
      }
    }
  `)
  return (
    <Wrapper>
      <ProductsGrid>
        {edges.map(({ node }) => {
          return <Product key={node.shopifyId} product={node} />
        })}
      </ProductsGrid>
    </Wrapper>
  )
}

export default Products

I added query Products because I thought it'll help but it didn't.

Steps to reproduce

Expected result

website should work in production

Actual result

some problems with static query I guess

System:
OS: macOS 10.15.6
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.14.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.8 - /usr/local/bin/npm
Languages:
Python: 2.7.16 - /usr/bin/python
Browsers:
Chrome: 84.0.4147.125
Firefox: 79.0
Safari: 13.1.2
npmPackages:
gatsby: ^2.17.4 => 2.24.10
gatsby-cli: ^2.12.62 => 2.12.65
gatsby-image: ^2.2.29 => 2.4.13
gatsby-plugin-google-analytics: ^2.0.13 => 2.3.13
gatsby-plugin-layout: ^1.0.11 => 1.3.10
gatsby-plugin-manifest: ^2.2.23 => 2.4.20
gatsby-plugin-offline: ^3.0.16 => 3.2.20
gatsby-plugin-react-helmet: ^3.1.13 => 3.3.10
gatsby-plugin-root-import: ^2.0.5 => 2.0.5
gatsby-plugin-sharp: ^2.2.32 => 2.6.21
gatsby-plugin-styled-components: ^3.3.10 => 3.3.10
gatsby-plugin-transition-link: ^1.20.2 => 1.20.2
gatsby-plugin-web-font-loader: ^1.0.4 => 1.0.4
gatsby-source-filesystem: ^2.1.33 => 2.3.22
gatsby-source-graphql: ^2.6.2 => 2.6.2
gatsby-source-shopify: ^3.2.24 => 3.2.24
gatsby-transformer-sharp: ^2.3.0 => 2.5.11
npmGlobalPackages:
gatsby-cli: 2.12.87

@jack0wsky jack0wsky added the type: bug An issue or pull request relating to a bug in Gatsby label Aug 20, 2020
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Aug 20, 2020
@pieh pieh added topic: StaticQuery and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Aug 20, 2020
@pieh
Copy link
Contributor

pieh commented Aug 20, 2020

Could you try updating gatsby and gatsby-plugin-offline to latest versions? There were couple of fixes related to static queries in those packages. If that doesn't help - could you share a link to your project (preferably) or to site deployed to Vercel so we could try debugging the runtime and see what's going wrong there?

@pieh pieh added the status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. label Aug 20, 2020
@jack0wsky
Copy link
Author

I guess I figured it out. For some reason the problem was in useStaticQuery hook. I switched to StaticQuery component and problem is solved.

@barbalex
Copy link

barbalex commented Sep 1, 2020

I just had the exact same error - ONLY ON PRODUCTION!

The error did not appear in dev.

I then realized that the only place I used a static query (via the useStaticQuery hook) could just as well accept a hardcoded value. After changing that the next update to production did not error any more. Phew!

I had updated the project just before. So all gatsby parts were up to date, see here: https://github.com/FNSKtZH/ae2/blob/5673e1d282e67e0c52ffff116e27c41d089e912e/package.json

@Jaikant
Copy link
Contributor

Jaikant commented Sep 5, 2020

Facing the same issue.

gatsby version 2.24.53

and I do not have gatsby-plugin-offline installed.

@wardpeet
Copy link
Contributor

@jack0wsky @barbalex @Jaikant could you please create a reproduction for us or share your repository. We haven't been able to reproduce this issue. You can always sent me an email at ward@gatsbyjs.com

@wardpeet
Copy link
Contributor

I've had a call with a customer and they were using cloudfront CDN. Everything was cached, please make sure you do not cache HTML, page-data folder! See https://www.gatsbyjs.com/docs/caching/

@barbalex
Copy link

Being a complete noob in these matters: Does https://vercel.com/docs/edge-network/caching mean that that happened in my case too?

@wardpeet
Copy link
Contributor

wardpeet commented Sep 21, 2020

@barbalex I'm not sure, if I believe their source code it should have the correct cache-control:
https://github.com/vercel/vercel/blob/35fd7b5f9c628f9304cd9d2dcce9446ec4a2c1c7/packages/now-static-build/src/frameworks.ts#L72-L76

Perhaps it's something else, is it https://gabriel-software.ch? If so can you point me to a commit where it was broken? I could play with vercel and see if I can get to the same issue. (it might be offline plugin)

@barbalex
Copy link

@wardpeet
It was this repository: https://github.com/FNSKtZH/ae2. If you check it out at commit 5673e1d282e67e0c52ffff116e27c41d089e912e you get the version that errored.

The repository is open source. Only the data in the postgresql database backing it up is not.

I just realized that this is the only one of my projects that I do not deploy via vercel (sorry for the noise!) but rather via the docker-compose.yml in the backend directory that is run in a docker droplet of digitalocean.com.

That docker backend uses caddy to serve the html folder. As I never spent any thought on caching and do not understand how that is done by caddy it is possible that it's caching was too aggressive. This may not have been a good idea but at the time I had just tried out building the backend via docker (migrating from more traditional, self configured droplets) and I simply gave this way to do it a shot. And it did work a few weeks before the incident and since.

@wardpeet
Copy link
Contributor

wardpeet commented Oct 7, 2020

well what this issue is showing is that we should make people more aware of caching and/or update static-query to contain a timestamp

@einarpersson
Copy link

einarpersson commented Oct 7, 2020

I just got the same error message running Gatsby in production on Vercel: StaticQuery could not be fetched...

The latest commit was totally harmless, I just removed a file which was not referenced anywhere. And after doing another change to README.md it suddenly began to work in production.

This is super confusing for someone who is new to Gatsby

@kbrock84
Copy link

I am currently getting this error. Initially I only noticed it after our build server pushed it to our staging environment. It took me forever, but I finally reproduced it locally with the following:

  1. go back to previous commit

  2. delete node_modules

  3. npm install

  4. Then I ran into a separate issue with babel so I ran npm upgrade gatsby which also upgraded the @babel dependencies.

  5. Finally gatsby build && gatsby serve

I was able to view the exact error locally, which is causing some of the data to not show on the page. It feels like a dependency issue.

@kbrock84
Copy link

Ok, so building using gatsby build --no-uglify gave me an idea of where the error was coming from. Changed that form useStaticQuery to a StaticQuery component and the error went away.

The site looks great now EXCEPT there is a random "Loading (StaticQuery)" inside a div on the page. This has to be related, but at least it's not breaking anything now.

Again, this only happens on the production build.

@claygiffin
Copy link

I am running into this same issue. It happens with nearly every production build that I push to Netlify. I have not been able to reproduce the issue locally, and there are no build errors.

On my production site, the only solution I've found is to clear the cache and rebuild after each site update.

My current dependencies are:

"dependencies": {
    "babel-plugin-styled-components": "^1.11.1",
    "bowser": "^2.11.0",
    "gatsby": "^2.24.78",
    "gatsby-image": "^2.4.21",
    "gatsby-plugin-anchor-links": "^1.1.1",
    "gatsby-plugin-facebook-pixel": "^1.0.5",
    "gatsby-plugin-google-analytics": "^2.3.14",
    "gatsby-plugin-manifest": "^2.4.34",
    "gatsby-plugin-netlify": "^2.3.19",
    "gatsby-plugin-netlify-cache": "^1.2.0",
    "gatsby-plugin-react-helmet": "^3.3.14",
    "gatsby-plugin-react-svg": "^3.0.0",
    "gatsby-plugin-sharp": "^2.6.42",
    "gatsby-plugin-styled-components": "^3.3.14",
    "gatsby-source-filesystem": "^2.3.34",
    "gatsby-transformer-sharp": "^2.5.17",
    "google-map-react": "^2.1.8",
    "lodash": "^4.17.20",
    "modern-normalize": "^1.0.0",
    "polished": "^4.0.2",
    "prop-types": "^15.7.2",
    "react": "^16.14.0",
    "react-dom": "^16.14.0",
    "react-google-maps": "^9.4.5",
    "react-helmet": "^6.1.0",
    "react-icons": "^3.11.0",
    "react-intersection-observer": "^8.29.0",
    "react-merge-refs": "^1.1.0",
    "react-player": "^2.6.2",
    "react-portal": "^4.2.1",
    "react-spring": "^8.0.27",
    "styled-components": "^5.2.0"
  },
  "devDependencies": {
    "@types/styled-components": "^5.1.4",
    "prettier": "2.1.2"
  },

@wardpeet
Copy link
Contributor

🤔 I assumed it was caching headers or the platform not purging but it seems like we should add a hash to the file

@andreydrozd-smfe
Copy link

I too am experiencing this issue and it's definitely not a cache issue for me. I too do not experience this issue locally.

I'm setting up a staging environment with no cache, just hosting the files on S3, and I am getting an undefined property error. It's like the query never ran. I empty the S3 bucket manually and redeploy, and the issue is still there.

My current dependencies are:

"dependencies": {
    "@fortawesome/fontawesome-svg-core": "^1.2.22",
    "@fortawesome/free-brands-svg-icons": "^5.11.2",
    "@fortawesome/free-regular-svg-icons": "^5.11.2",
    "@fortawesome/free-solid-svg-icons": "^5.10.2",
    "@fortawesome/react-fontawesome": "^0.1.4",
    "@rhysforyou/gatsby-plugin-safari-site-icon": "^1.0.2",
    "@statuspage/status-widget": "^1.0.4",
    "babel-plugin-styled-components": "^1.10.6",
    "bootstrap": "^4.3.1",
    "crypto-browserify": "^3.12.0",
    "env-cmd": "^10.0.1",
    "gatsby": "^2.13.73",
    "gatsby-image": "^2.2.10",
    "gatsby-plugin-canonical-urls": "^2.1.18",
    "gatsby-plugin-facebook-pixel": "^1.0.3",
    "gatsby-plugin-favicon": "^3.1.6",
    "gatsby-plugin-google-analytics": "^2.1.23",
    "gatsby-plugin-lodash": "^3.1.8",
    "gatsby-plugin-manifest": "^2.2.6",
    "gatsby-plugin-offline": "^2.2.7",
    "gatsby-plugin-react-helmet": "^3.1.4",
    "gatsby-plugin-resolve-src": "^2.0.0",
    "gatsby-plugin-s3": "^0.3.2",
    "gatsby-plugin-sharp": "^2.2.13",
    "gatsby-plugin-sitemap": "^2.2.21",
    "gatsby-plugin-styled-components": "^3.1.11",
    "gatsby-plugin-web-font-loader": "^1.0.4",
    "gatsby-source-filesystem": "^2.1.11",
    "gatsby-source-prismic-graphql": "~3.4.0-beta.2",
    "gatsby-transformer-sharp": "^2.2.7",
    "js-cookie": "^2.2.1",
    "lodash": "^4.17.15",
    "memoize-one": "^5.1.1",
    "moment": "^2.24.0",
    "moment-timezone": "^0.5.27",
    "polished": "^3.4.1",
    "prismic-reactjs": "^1.0.1",
    "prop-types": "^15.7.2",
    "querystring": "^0.2.0",
    "react": "^16.9.0",
    "react-big-calendar": "^0.22.1",
    "react-cookie-consent": "^2.5.0",
    "react-dom": "^16.9.0",
    "react-helmet": "^5.2.1",
    "react-hooks-sse": "^1.0.0",
    "react-lazyload": "^2.6.5",
    "react-select": "^3.1.0",
    "react-slick": "^0.25.2",
    "react-string-replace": "^0.4.4",
    "react-super-responsive-table": "^5.1.1",
    "react-tooltip": "^3.11.1",
    "react-vis": "^1.11.7",
    "reactstrap": "^8.0.1",
    "slick-carousel": "^1.8.1",
    "smooth-scroll": "^16.1.0",
    "socket.io-client": "^2.3.0",
    "stickybits": "^3.7.1",
    "styled-components": "^4.3.2",
    "styled-tools": "^1.7.1",
    "whatwg-fetch": "^3.0.0"
  },

@claygiffin
Copy link

claygiffin commented Oct 19, 2020

I may have figured out what the issue is. I haven't run into this error for my last few builds now after making this change.

When I set up my new Gatsby project, I changed the case of the default components (layout.js and seo.js) to be PascalCase (Layout.js, SEO.js). I know that git by default ignores changes in filename case, so I had to update my git.config to register these changes by running git config core.ignorecase false.

However, it appears that the original lowercase file was never completely removed. It didn't appear in my repository or local branch, but I noticed that when I staged my changes in VSCODE, both the lowercase and uppercase versions of the files were listed!

To fully remove the old versions of the files, I had to run:

git mv -f src/components/layout.js src/components/Layout.js &&
git mv -f src/components/seo.js src/components/SEO.js

Pushing that change seems to have fixed the Static Query error.

@wardpeet
Copy link
Contributor

Oh I'll try to use this as a reproduction 👍 Thanks!

@persocon
Copy link

persocon commented Oct 21, 2020

any news? I tried all the solutions, none works :/ and I can't update any staticquery on the company website because it breaks EVERYTHING

edit:
<StaticQuery /> works but useStaticQuery doesn't and I have a bunch of places that I use the useStaticQuery :/

@gerisztein
Copy link

Same issue as @persocon ☝️

any news? I tried all the solutions, none works :/ and I can't update any staticquery on the company website because it breaks EVERYTHING

edit:
<StaticQuery /> works but useStaticQuery doesn't and I have a bunch of places that I use the useStaticQuery :/

@AbdulSamadMalik
Copy link

    Simple Solution

  1. Just capitalize the file name of the component in which you are using useStaticQuery hook.

    Example: from header.js   -->   Header.js

  2. Then clear Gatsby cache and restart the server.

  3. This should fix the problem.

@ScottGuymer
Copy link

@AbdulSamadMalik this did not seems to solve the problem for me on windows.

@Jassi10000-zz
Copy link

@AbdulSamadMalik this did not seems to solve the problem for me on windows.
yes @AbdulSamadMalik for me too it doesn't solve the problem

@AbdulSamadMalik
Copy link

@AbdulSamadMalik this did not seems to solve the problem for me on windows.
yes @AbdulSamadMalik for me too it doesn't solve the problem

Well these are my dependencies make sure you have same versions as these

{
  "dependencies": {
    "gatsby": "^3.11.1",
    "gatsby-plugin-minify-classnames": "^0.3.1",
    "gatsby-plugin-react-helmet": "^4.12.0",
    "gatsby-plugin-sass": "^4.12.0",
    "gatsby-plugin-sitemap": "^4.8.0",
    "gatsby-source-filesystem": "^3.12.0",
    "gatsby-transformer-json": "^3.12.0",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-helmet": "^6.1.0",
    "sass": "^1.38.1"
 },
 "devDependencies": {
    "@types/react-helmet": "^6.1.2",
    "prettier": "2.3.2",
    "typescript": "^4.3.5"
  }
}

@Floriferous
Copy link

This error seems to happen to so many people, for completely different reasons. Isn't it possible to send more information along with this error, so we have the smallest chance to find what's going on?

The query could not be fetched: XYZ did not work would solve so many issues.

We've been seeing this error on all the versions of gatsby we've tried, we tried a ton of fixes suggested here and in the dozens of other issues with this error, and nothing ever worked. From v2.20 to today's 3.10 in my history.

@kriscoleman
Copy link

We ran into this problem too, and nothing here seemed to fix it.

We have decided as a team that we can't trust useStaticQuery.

Our problem also came from the SEO component that we implemented which followed this doc: https://www.gatsbyjs.com/docs/add-seo-component/

We realized there really was no reason to have to use the useStaticQuery hook in the seo component, or any query for that matter. Instead we implemented it so that all the data needed for the helmet rendering is passed in via props. Now the SEO component doesn't care how you get your SEO data, and it's easy to test too.

Now you can decide how to query for your SEO data however you want in your consumers. Since we're avoiding static queries, we just added the seo data to our pages query so it's pulled in along with the rest of the page data at build time.

Works really well and is a lot simpler than using a query in the SEO component.

Sadly, I don't have any answer for why the useStaticQuery hook seems to break infrequently and sometimes gatsby clean resolves it, but I do know that the query seems to query against our global context, and the behavior seems to suggest that sometimes it's undefined, and another developer above mentioned a few days ago they were able to capture the global context that's made in createContext sometimes being undefined, and they questioned if something (maybe a plugin?) is stomping on it sometimes, and I think that sounds really, really likely here.

@davwheat
Copy link
Contributor

davwheat commented Oct 6, 2021

I'm now encountering this issue too.

  • useStaticQuery is being called inside a component
  • That component is used solely within a single MDX file
  • Which is embedded into an MDX renderer inside a page template

This issue is happening on dev and prod, with Gatsby 4.

Repo with issue at specific commit hash: https://github.com/davwheat/personal-portfolio/tree/0ad42bf72eefb26dfd5432b99f903f8e7060a7c7

The troublesome code is here: https://github.com/davwheat/personal-portfolio/blob/0ad42bf72eefb26dfd5432b99f903f8e7060a7c7/blog/2021/10/04/CoverageResourceBlocksDiagram.tsx#L119-L126

...which is only referenced within MDX here: https://github.com/davwheat/personal-portfolio/blob/0ad42bf72eefb26dfd5432b99f903f8e7060a7c7/blog/2021/10/04/speed-differences-high-low-frequencies.mdx

All I wanted to do was reference an SVG file via its public URL instead of a data URI! 😅


The dev error I see is

Can't resolve '../../../../public/page-data/sq/d/528802963.json' in 'C:\Users\dwhea\Desktop\Git Repos\personal-portfolio\blog\2021\10\04'

If you're trying to use a package make sure that '../../../../public/page-data/sq/d/528802963.json' is installed. If you're trying to use a local file make sure that   
the path is correct.

and lsing the dir in question shows me that there are only these files present:

C:\Users\dwhea\Desktop\Git Repos\personal-portfolio>ls public/page-data/sq/d
3360246512.json  63159454.json

What is interesting is that the page data for the broken blog article references those other two static query hashes, but not the 528xxx that is attempting to be imported:

// Page data from page-data.json for the failed page "/blog/2021/10/04/speed-differences-high-low-frequencies":
{
  "componentChunkName": "component---src-templates-blog-article-blog-page-template-tsx",
  "path": "/blog/2021/10/04/speed-differences-high-low-frequencies",
  "result": {
        // [clipped for readability] ...
        "path": "2021/10/04/speed-differences-high-low-frequencies",
        "redirect_from": null,
        "created_at": "4 October 2021 13:00",
        "updated_at": "4 October 2021 13:00",
        "archived": false
      },
      "page": 1
    }
  },
  "staticQueryHashes": [
    "3360246512",
    "63159454"
  ]
}

I've installed the Webpack plugin that @KyleAMathews suggested in his earlier reply, which didn't reveal any capitalisation issues. My NTFS filesystem is set to case sensitive anyway, and I use GH Actions for building, so that would have normally raised any issues beforehand.

@kalahooo
Copy link

kalahooo commented Oct 8, 2021

@davwheat, you are trying to use useStaticQuery outside the src folder.
This might help you: #30974 (comment)

@chriszrc
Copy link

chriszrc commented Oct 20, 2021

I find this message pops up sometimes when there is an actual error in the code somewhere, like a double import (in typescript), etc. Sometimes, a gatsby clean takes care of it. It's very unfortunate, since the real problem has nothing to do with the useStaticQuery hook-

@jsg2021
Copy link

jsg2021 commented Nov 21, 2021

https://github.com/jsg2021/gatsby-staticquery-error-repro this is my min reproduction... in gatsby 2 it's fine.

Ah, mixing gatsby-plugin-mdx and gatsby-plugin-feed trigger this

@samarthvats9
Copy link

Hey, I am new to this but I have tried this - npm install react@^16.8.0 react-dom@^16.8.0 and it's working now. Please let me know if this is of any help.

@andymcgunagle
Copy link

Ran into the "The result of this StaticQuery could not be fetched" error while following along with a tutorial and it took about 30 minutes to figure out the issue.

I tried "gatsby clean" and deleting and reinstalling my node_modules directory multiple times with no success.

I had extracted my query to a useSiteMetadata hook and initially accidentally capitalized the "D" when I created my "useSiteMetaData.js" file, which caused it to be imported as "../hooks/useSiteMetaData.js" in my Nav component. I had changed the filename to "useSiteMetadata.js" but that import was still using the initial capital "D" casing.

I corrected the import path to "../hooks/useSiteMetadata.js" and ran "gatsby clean" and the error disappeared.

As an extra note, I also removed the cookies in localhost:8000 - I had tried this a few times before with no effect, but I did it right before fixing the import path casing, so wanted to note that just in case.

@pragmaticpat pragmaticpat added topic: source-wordpress Related to Gatsby's integration with WordPress topic: source-drupal Related to Gatsby's integration with Drupal topic: source-contentful Related to Gatsby's integration with Contentful topic: source-shopify Related to the gatsby-source-shopify plugin topic: source-plugins Relates to the Gatsby source plugins (e.g. -filesystem) labels May 6, 2022
@LekoArts LekoArts removed topic: source-wordpress Related to Gatsby's integration with WordPress topic: source-drupal Related to Gatsby's integration with Drupal topic: source-contentful Related to Gatsby's integration with Contentful topic: source-shopify Related to the gatsby-source-shopify plugin topic: source-plugins Relates to the Gatsby source plugins (e.g. -filesystem) labels May 9, 2022
@LekoArts
Copy link
Contributor

LekoArts commented May 9, 2022

This is a long opened issue that isn't actionable anymore as we merged PRs like #33956 in the meantime and thus the overall environment has changed dramatically. If you still encounter this issue on Gatsby 4 and can provide a minimal reproduction, please open a new issue. (Comments on this one will be lost)

@LekoArts LekoArts closed this as completed May 9, 2022
@jsg2021
Copy link

jsg2021 commented May 10, 2022

Its probably caused by the rss feed query requesting 'html' field: https://www.gatsbyjs.com/plugins/gatsby-plugin-feed/
When I remove that part of the query, the error goes away.

@ghost
Copy link

ghost commented Aug 25, 2022

It is still happening in Gatsby 4.

I don't use gatsby-plugin-mdx, gatsby-plugin-feed or gatsby-plugin-offline. It happens when I redeploy a build with changes to the query. It looks like something is cached in the browser because in incognito it works. Its is quite a big issue because when people revisit the website after the change they see a broken website..

I use useStaticQuery.

@jeustan
Copy link

jeustan commented Nov 18, 2022

Just trying to follow along with the tutorial and I'm stuck on this Unhandled Runtime Error. It does not occur on the Gatsby Cloud hosted version, however, it does occur locally. Tried incognito, doesn't work. Tried clean, clearing browser cache, reinstalling packages, scouring the code (most of it is copy pasted from the tutorial), nothing works.

It started when I added {mdx.frontmatter__slug}.js in part 6 of the tutorial to generate page templates. Instead I get 'Error in function useStaticQuery in ./.cache/static-query.js:83'

I'm really stumped, by the tutorial. Wow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: GraphQL Related to Gatsby's GraphQL layer type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests