[next-auth][error][JWT_SESSION_ERROR]

Solution:
Read the error message. It has 1) Link to the page in the docs you need 2) A place in the file where this error occurred (auth.ts line 106) 3) What the error is (You did something.id, when something is undefined)...
Jump to solution
5 Replies
Solution
Matvey
Matvey16mo ago
Read the error message. It has 1) Link to the page in the docs you need 2) A place in the file where this error occurred (auth.ts line 106) 3) What the error is (You did something.id, when something is undefined)
gave_one
gave_oneOP16mo ago
it's weird there's nothing in line 106 yeah, I looked at the error before I posted the outline 106. There's nothing.
gave_one
gave_oneOP16mo ago
f2bear
f2bear16mo ago
I'm facing the same error, noticed that it's produced on the jwt callback but still don't know why or how to solve it if you try to console.log the user.id value inside the jwt callback it's shown as undefined and that is what it's causing the error the weird thing is that if I change the strategy to 'database' everything works fine but that does not allow me to use the credentials provider my error message is mentioning an empty line in my code as well and that also weirds me out a bit
Anirudh
Anirudh13mo ago
Try passing "secret" property which explicitly points to your NEXTAUTH_SECRET env variable inside authOptions object inside auth.ts file. Like this, secret: process.env.NEXTAUTH_SECRET. Doing this solved this error for me & all callbacks work properly with jwt stratergy.
Want results from more Discord servers?
Add your server