#Debugging - TypeError: Cannot read properties of null (reading 'useContext')

5 messages · Page 1 of 1 (latest)

fossil dune
#

I get this on my built and deployed app running in a containerised environment:

hook.js:608 TypeError: Cannot read properties of null (reading 'useContext')
    at react.production.min.js:24:495
    at s (VersionedContext.esm.js:12:10)
    at x (useApp.esm.js:4:28)
    at Y (extensions.esm.js:82:21)
    at Ci (react-dom.production.min.js:167:137)
    at ta (react-dom.production.min.js:290:337)
    at qs (react-dom.production.min.js:280:389)
    at Jc (react-dom.production.min.js:280:320)
    at Hr (react-dom.production.min.js:280:180)
    at Yi (react-dom.production.min.js:271:88)

This error doesn't happen locally - it works fine while running within yarn dev. How do I even begin to debug it?

It essentially happens when view a page that is coming from a custom plugin I'm developing. It occurs immediately after loading the plugin tab of the service. No data has been loaded from the backend at this point.

mild trench
#

Hitted that as well, but in dev.

Is coming from different react version than the one in root package.
Try execute yarn why react the only dependency should come from app

fossil dune
#

@mild trench thank you!
Do you just mean, in the root of the repo, literally yarn why react ?

#

I get this:

~/s/g/b/backstage main 2.9s ❱ 
yarn why react
└─ app@workspace:packages/app
   └─ react@npm:18.2.0 (via npm:^18.0.2)
mild trench
#

Hmmm not sure then, at least for me was a mismatch in react version.