Skip to content

Instantly share code, notes, and snippets.

@ADTC
Last active January 31, 2024 15:56
Show Gist options
  • Save ADTC/1ad4819364e8efced2c5090f7403ebee to your computer and use it in GitHub Desktop.
Save ADTC/1ad4819364e8efced2c5090f7403ebee to your computer and use it in GitHub Desktop.
Weird Error in Nextjs using Auth0: See https://github.com/auth0/nextjs-auth0/issues/1653
nextjs-auth0 is attempting to set cookies from a server component,see https://github.com/auth0/nextjs-auth0#using-this-sdk-with-react-server-components
nextjs-auth0 is attempting to set cookies from a server component,see https://github.com/auth0/nextjs-auth0#using-this-sdk-with-react-server-components
Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
TypeError: Cannot read properties of null (reading 'useContext')
at t.useContext (/Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:162991)
at usePathname (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/navigation.js:123:34)
at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:160:50)
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 ak (/Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:46552)
at av (/Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:7809)
at /Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:12972
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 av (/Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:7809)
at /Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:12972
at aw (/Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:13009)
at ak (/Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:46552)
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)
⨯ 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)
⨯ TypeError: Cannot read properties of null (reading 'useContext')
at t.useContext (/Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:162991)
at usePathname (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/navigation.js:123:34)
at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:160:50)
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 ak (/Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:46552)
at av (/Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:7809)
at /Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:12972
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 av (/Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:7809)
at /Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:12972
at aw (/Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:13009)
at ak (/Users/user/project/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:46552)
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) {
page: '/current/route/path'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment