Gatsby StaticQuery stopped working

Hi Guys,

I have a Gatsby site that has been running fine up until Friday 24th July. Now I am getting the below error. If I refresh the page the query resolves. The site works fine when I run it locally in dev. If anyone is experiencing something similar I would love some advice.

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 b (SiteLinks.js:9)
    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 scheduler.production.min.js:19

Netlify site name: pensive-galileo-93ca02

Thanks
James

hi there, that’s frustrating. Did you reach out to gatsby as described in the error message? Seems like it is a bit of a known issue :thinking:

I had the same problem. I updated all my npm dependencies and that fixed it.

1 Like

Hi, @willmcl. Thank you for sharing this solution here!

import React from 'react'
import { graphql, useStaticQuery } from 'gatsby'
import Img from 'gatsby-image'

const Image = ({ fileName, alt, style, className }) => {
  const { allImageSharp } = useStaticQuery(graphql`
    query Image {
      allImageSharp {
        nodes {
          fluid {
            src
            srcSet
            originalName
          }
        }
      }
    }
  `)

  const fluid = allImageSharp.nodes.find(
    (n) => n.fluid.originalName === fileName
  ).fluid

  return (
    <figure>
      <Img
        fluid={fluid}
        alt={alt}
        imgStyle={{ position: 'relative' }}
        style={style}
        className={className}
      />
    </figure>
  )
}

export default Image
 <Image
           fileName={product.image}
            style={{ width: '100%' }}
 />

Very simple image component, Its working fine in gatsby and not working netlifycms admin

![image|690x96](upload://v2lUGvkcmvTVqrmaqvyaGKiYzZe.png)

Hey there, @shijomart :wave:

Welcome to the Forums! Unfortunately, I am not entirely sure what you are asking here.

Please help us by writing a full post in the future, in addition to sharing your code! Additionally, please make sure you are commenting on related threads. If your question is not related to any threads you find, go ahead and open a new one!

When commenting on a thread or opening a new one, helpful information to include is:

  1. What information you are looking to receive / what problem you are looking to solve.
  2. Your site name
  3. Your repo
  4. Any error messages being received.

Thank you!