Unhandled Runtime Error - Error in function useStaticQuery in ./.cache/gatsby-browser-entry.js:77
See original GitHub issuePreliminary Checks
- This issue is not a duplicate. Before opening a new issue, please search existing issues: https://github.com/gatsbyjs/gatsby/issues
- This issue is not a question, feature request, RFC, or anything other than a bug report directly related to Gatsby. Please post those things in GitHub Discussions: https://github.com/gatsbyjs/gatsby/discussions
Description
No matter what I do, I simply cannot get useStaticQuery to work. I’ve tried putting it in different components, tried changing the name of the components to both start with a Capital letter and with a lowercase error, i’ve tried deleting the node modules folder and reinstalling, as well as using gatsby clean
. Nothing seems to be working.
Reproduction Link
https://github.com/iamshaunjp/gatsby-tutorial/blob/lesson-10/src/components/Navbar.js
Steps to Reproduce
- Implement useStaticQuery in any component
Expected Result
Have the query execute successfully, not prompt me with an error, and allow me to retrieve the contents of said query.
Actual Result
Environment
System:
OS: Windows 10 10.0.19042
CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor
Binaries:
Node: 14.17.0 - D:\Apps-Utils\nodejs\node.EXE
Yarn: 1.22.15 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.0.0 - D:\Apps-Utils\nodejs\npm.CMD
Languages:
Python: 3.9.5
Browsers:
Edge: Spartan (44.19041.1023.0), Chromium (94.0.992.38)
npmPackages:
gatsby: ^3.13.1 => 3.14.2
gatsby-link: ^3.14.0 => 3.14.0
gatsby-react-router-scroll: ^4.14.0 => 4.14.0
npmGlobalPackages:
gatsby-cli: 3.14.1
Config Flags
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:13 (1 by maintainers)
Top Results From Across the Web
Cannot change query name in Graphql - gatsby
Error in function useStaticQuery in ./.cache/gatsby-browser-entry.js:77. Try stopping the gatsby develop command, change the query name, ...
Read more >Unhandled Runtime Error
One unhandled runtime error found in your files. See the list below to fix it: Error in function useStaticQuery in ./.cache/gatsby-browser-entry.js:77.
Read more >Troubleshooting Common Errors
You may see this error because you're attempting to use fs inside a React component. Additionally, it often shows up when working with...
Read more >Support
I've tried changing npm run build to gatsby build under the build command. Tried deleting the package-lock.json and npm installing.
Read more >Henkilöstövastuu
One unhandled runtime error found in your files. See the list below to fix it: Error in function useStaticQuery in ./.cache/gatsby-browser-entry.js:77.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have same problem and resolved, do you have rename any component recently, if have you need to double check where that component import to, sometime when you change name,import path for component not change automatic too.
Same issue with a Frontend Masters course. Since it won’t go away I’m pretty much dead in the water now.