Nextjs-auth0: Support with Next.js v10.0.0?

Created on 31 Oct 2020  路  11Comments  路  Source: auth0/nextjs-auth0

Description

I'm putting this ticket in because when I try to install the latest version of the @auth0/nextjs-auth0 package with next.js v10.0.0, I receive the following error when I do an npm install:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/next
npm ERR!   next@"^10.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer next@"^9.0.0" from @auth0/[email protected]
npm ERR! node_modules/@auth0/nextjs-auth0
npm ERR!   @auth0/nextjs-auth0@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Here's the information about the error

{
  "code": "ERESOLVE",
  "current": {
    "name": "next",
    "version": "10.0.0",
    "whileInstalling": {
      "name": "fullstack",
      "version": "1.0.0",
      "path": "/Users/user/dev/fullstack-prisma/fullstack"
    },
    "location": "node_modules/next",
    "dependents": [
      {
        "type": "prod",
        "name": "next",
        "spec": "^10.0.0",
        "from": {
          "location": "/Users/user/dev/fullstack-prisma/fullstack"
        }
      }
    ]
  },
  "edge": {
    "type": "peer",
    "name": "next",
    "spec": "^9.0.0",
    "error": "INVALID",
    "from": {
      "name": "@auth0/nextjs-auth0",
      "version": "0.16.0",
      "whileInstalling": {
        "name": "fullstack",
        "version": "1.0.0",
        "path": "/Users/user/dev/fullstack-prisma/fullstack"
      },
      "location": "node_modules/@auth0/nextjs-auth0",
      "dependents": [
        {
          "type": "prod",
          "name": "@auth0/nextjs-auth0",
          "spec": "*",
          "from": {
            "location": "/Users/user/dev/fullstack-prisma/fullstack"
          }
        }
      ]
    }
  },
  "peerConflict": null,
  "strictPeerDeps": false,
  "force": false
}

Environment

Please provide the following:

Next 10.0.0
@auth0/nextjs-auth0 0.16.0
Node 15.0.1
NPM 7.0.3

question

Most helpful comment

@helloitsm3 did you follow the instruction they described in the readme?

My code is somewhat similar. What happens when you try to access /api/profile?

@helloitsm3 It always returns null from session.user even though I was logged in.

Can you share some code so that we can help you to debug? I'm able to retrieve user information after logging in

let me try again. If I failed, I will share

All 11 comments

npm install @auth0/nextjs-auth0 --force will fix the error

Thanks @pieeee! Have you confirmed that this works with Nextjs 10?

@CaptainChemist however i installed this package with --force command. I don't now why, every-time I logged in, I always get a null value from session?.user. Do you have any idea? I followed the instructions from readme.md? Please letme know if you integrate package successfully with next.js

@CaptainChemist however i installed this package with --force command. I don't now why, every-time I logged in, I always get a null value from session?.user. Do you have any idea? I followed the instructions from readme.md? Please letme know if you integrate package successfully with next.js

Currently using NextJS 10.0.3. Was able to login successfully and retrive user's information

@helloitsm3 did you follow the instruction they described in the readme?

@helloitsm3 did you follow the instruction they described in the readme?

My code is somewhat similar. What happens when you try to access /api/profile?

@helloitsm3 did you follow the instruction they described in the readme?

My code is somewhat similar. What happens when you try to access /api/profile?

@helloitsm3 It always returns null from session.user even though I was logged in.

@helloitsm3 did you follow the instruction they described in the readme?

My code is somewhat similar. What happens when you try to access /api/profile?

@helloitsm3 It always returns null from session.user even though I was logged in.

Can you share some code so that we can help you to debug? I'm able to retrieve user information after logging in

@helloitsm3 did you follow the instruction they described in the readme?

My code is somewhat similar. What happens when you try to access /api/profile?

@helloitsm3 It always returns null from session.user even though I was logged in.

Can you share some code so that we can help you to debug? I'm able to retrieve user information after logging in

let me try again. If I failed, I will share

Hi @pieeee - are you still seeing issues?

If so please share the code that you are having issues with.

You could also try the new Beta here https://github.com/auth0/nextjs-auth0/releases/tag/v1.0.0-beta.0

The new Beta is tested against Next.js 10 so should resolve your issue

Closing due to inactivity - feel free to ping me if you want me to reopen

Was this page helpful?
0 / 5 - 0 ratings