MongoDB Duplicate Key Session Error

Hey there, I have been facing this problem for almost a MONTH now and still couldn't find a solution to this.

When I log in to my BetterAuth account, remove the session key from cookie, refresh the page and then log in again, I get an error from MongoDB. That's because there is already a session created for this user. So I have to manually remove session from db to log in again.

But I don't understand how I could fix this error as it makes impossible to have more sessions for one account.
I'm running express on backend and nextjs on frontend
image.png
Was this page helpful?