Next.js Discord

Discord Forum

Cannot read properties of null (reading 'useContext')

Unanswered
Caribbean Elaenia posted this in #help-forum
Open in Discord
Caribbean ElaeniaOP
I'm currently having some issues when using "next build". Using "npm run build" works but the static files are not working (not being served) no idea why.

I use the "useContext()" almost in all of my files, but I'm sure it doesn't return an undefined value as I've assigned them a valid value.

You may see the page.jsx (home) file attached below.

5 Replies

Caribbean ElaeniaOP
This is the themeContext
When I use the "npm run build" it works fine but files are not being served as it says; "Bad gateway Error code 502"
I always had this problem but I don't remember how I've solved it 💀
I think I used npm run build
This is my structure