Next / Auth trying to create duplicate sessions and getting errors.

Sometimes when developing locally while trying to signin to discord I am getting errors where it is trying to create a new session in my DB when there is an already existing session.

Is there a way to avoid this from happening at all?

INSERT INTO `stat-tracker`.`Session` (`id`,`sessionToken`,`userId`,`expires`) VALUES (?,?,?,?)
prisma:query ROLLBACK
prisma:error 
Invalid `p.session.create()` invocation in
/<path_to_nodes>/node_modules/@next-auth/prisma-adapter/dist/index.js:233:44

  230     const { user, ...session } = userAndSession;
  231     return { user, session };
  232 },
→ 233 createSession: (data) => p.session.create(
Unique constraint failed on the (not available)
[next-auth][error][adapter_error_createSession] 
https://next-auth.js.org/errors#adapter_error_createsession 
Invalid `p.session.create()` invocation in
/<path_to_nodes>/node_modules/@next-auth/prisma-adapter/dist/index.js:233:44

  230     const { user, ...session } = userAndSession;
  231     return { user, session };
  232 },
→ 233 createSession: (data) => p.session.create(
Unique constraint failed .....
Was this page helpful?