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

Viewed 1276

That is quite strange... I was working on a completely different part of the project and out of nowhere, I've started to get this error from different files. I have tested my query on query panel (path /___graphql); working like a charm. I have started to comment out component that giving error, then similar error happened another file.

One of the failed staticQuery that has been working for a long time is :

const Data = useStaticQuery(graphql`
    query {
      saasClassicJson {
        FOOTER_WIDGET {
          title
          menuItems {
            text
            url
          }
        }
      }
    }
  `);

  return ...
};

I am using :

  • Gatsby CLI 2.12.48
  • Gatsby 2.20.29
2 Answers

It appears that problem was about .cache folder having corrupted build data.

Removing .cache and re-running project solved the problem.

Clear your .cache by running the following command, make sure gatsby CLI is installed globally.

gatsby clean
Related