[next-auth][error][JWT_SESSION_ERROR]
auth code here : https://paste.gg/p/anonymous/64f72742fab84547a08a8910e8358580
![](https://cdn.answeroverflow.com/1137854822452842688/Screenshot_2023-08-06_at_2.04.38_PM.png)
Solution:Jump to 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
)...5 Replies
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
)it's weird there's nothing in line 106
yeah, I looked at the error before I posted the outline 106. There's nothing.
![](https://cdn.answeroverflow.com/1137916855701483670/Screenshot_2023-08-06_at_6.14.53_PM.png)
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
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.