nextjs-auth0
nextjs-auth0 copied to clipboard
Internal error: TypeError: Cannot read properties of null (reading 'useState')
Checklist
- [X] The issue can be reproduced in the nextjs-auth0 sample app (or N/A).
- [X] I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
- [X] I have looked into the API documentation and have not found a suitable solution or answer.
- [X] I have searched the issues and have not found a suitable solution or answer.
- [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- [X] I agree to the terms within the Auth0 Code of Conduct.
Description
I'm randomly getting the following error on server.
⨯ Internal error: TypeError: Cannot read properties of null (reading 'useState')
at t.useState (/Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:163696)
at exports.default (./node_modules/@auth0/nextjs-auth0/dist/client/use-user.js:82:52)
at as (/Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:6391)
at /Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:11242
at aw (/Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:13009)
at aw (/Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:43309)
at ak (/Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:46552)
at ak (/Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:46847)
at /Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:55430
at /Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:56107
at aD (/Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:56115)
at Timeout._onTimeout (/Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:4293)
at listOnTimeout (node:internal/timers:573:17)
at process.processTimers (node:internal/timers:514:7)
Note, due to the random nature of the error, it may not be possible to reproduce this in the sample project. Let me know if it's required. I'll try.
Reproduction
- Open a Next.js 14 App Router project.
- Run the project in dev mode.
- Make changes so the page in browser will reload.
- Watch out for the error which may or may not occur.
Additional context
This occurs as part of a larger set of errors and warnings. Please see the full set in the Gist here. I don't know if #1614 is related to this or not.
nextjs-auth0 version
3.5.0
Next.js version
14.1.0
Node.js version
20.5.1