NextAuth deployments problems : Session NULL
Answered
Ninhache posted this in #help-forum
NinhacheOP
Hello, got a problem using NextAuth :
I've setup everything and had 0 problems by running
I've figured out the session is ALWAYS null even if the signIn got sucess..
I couldnt really post a reproductible example, i can tell you i'm using a CredentialsProvider and the way i'm getting the session can be found here :
Anyone ever figured out a similar problem ?
And then, someone ever fix the problem ?
I've setup everything and had 0 problems by running
run dev
, now, when i'm trying to deploy it i'm getting errors about URL.. (first of all it's weird because i've setup it.. but anyways)I've figured out the session is ALWAYS null even if the signIn got sucess..
I couldnt really post a reproductible example, i can tell you i'm using a CredentialsProvider and the way i'm getting the session can be found here :
export async function getServerSideProps(context) {
const session = await getSession(context)
// session === NULL
// there's a fetch here, that creates the error [CLIENT_FETCH_ERROR]
}
Anyone ever figured out a similar problem ?
And then, someone ever fix the problem ?
Answered by Ninhache
https://github.com/nextauthjs/next-auth/discussions/1466
URLs where missing, to fix i'd to add them in my .env..
URLs where missing, to fix i'd to add them in my .env..
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_URL_INTERNAL=http://127.0.0.1:3000
14 Replies
did you set up your NEXTAUTH_URL on deployment env?
NinhacheOP
bump 🤓 ..
Still the same problems :(
Still the same problems :(
NinhacheOP
I've found : https://github.com/auth0/nextjs-auth0/issues/575
and then associated SOF post : https://stackoverflow.com/questions/72457673/nextjs-next-auth-get-session-always-null
But i feel weird about this solution..
Should i put my cookie in my fetch authentification ? That's weird a bit..
and then associated SOF post : https://stackoverflow.com/questions/72457673/nextjs-next-auth-get-session-always-null
But i feel weird about this solution..
Should i put my cookie in my fetch authentification ? That's weird a bit..
And i'm keep getting null session lmao.. :^)
NinhacheOP
https://github.com/nextauthjs/next-auth/discussions/1466
URLs where missing, to fix i'd to add them in my .env..
URLs where missing, to fix i'd to add them in my .env..
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_URL_INTERNAL=http://127.0.0.1:3000
Answer
NinhacheOP
YOUHOU
SOLVED RN