question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unhandled Runtime Error - Error in function useStaticQuery in ./.cache/gatsby-browser-entry.js:77

See original GitHub issue

Preliminary Checks

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

  1. 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

image

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:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
minhtri0795commented, Nov 10, 2021

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.

1reaction
TheComeBackGuycommented, Oct 21, 2021

Same issue with a Frontend Masters course. Since it won’t go away I’m pretty much dead in the water now.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found