nextjs-auth0 icon indicating copy to clipboard operation
nextjs-auth0 copied to clipboard

Internal error: TypeError: Cannot read properties of null (reading 'useState')

Open ADTC opened this issue 1 year ago • 0 comments

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

  1. Open a Next.js 14 App Router project.
  2. Run the project in dev mode.
  3. Make changes so the page in browser will reload.
  4. 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

ADTC avatar Jan 31 '24 15:01 ADTC