Skip to content

Update schema.prisma #12594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

AbdulHaseeb-1
Copy link

Resolves the following error:

[auth][error] SignOutError: Read more at https://errors.authjs.dev#signouterror [auth][cause]: PrismaClientUnknownRequestError:
Invalid prisma.session.delete() invocation:

Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(PostgresError { code: "55000", message: "cannot delete from table "Session" because it does not have a replica identity and publishes deletes", severity: "ERROR", detail: None, column: None, hint: Some("To enable deleting from the table, set REPLICA IDENTITY using ALTER TABLE.") }), transient: false })
at Zr.handleRequestError (D:\Next-Js\local-store\node_modules@prisma\client\runtime\edge.js:20:7743)
at Zr.handleAndLogRequestError (D:\Next-Js\local-store\node_modules@prisma\client\runtime\edge.js:20:6875)
at Zr.request (D:\Next-Js\local-store\node_modules@prisma\client\runtime\edge.js:20:6588)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async l (D:\Next-Js\local-store\node_modules@prisma\client\runtime\edge.js:29:9538)
at async r. [as deleteSession] (D:\Next-Js\local-store.next\server\chunks\4686.js:34:52814)
at async oE (D:\Next-Js\local-store.next\server\chunks\4686.js:401:50161)
at async oR (D:\Next-Js\local-store.next\server\chunks\4686.js:401:52428)
at async oO (D:\Next-Js\local-store.next\server\chunks\4686.js:401:56536)
at async tr.do (D:\Next-Js\local-store\node_modules\next\dist\compiled\next-server\app-route.runtime.prod.js:18:17582)
[auth][details]: {}

☕️ Reasoning

1- Postgress SQL requires a unique identifier to track changes when deleting or updating in a row, if does't found it raises error of "replica identity" , by making sessionToken a primary key it will resolve this error generated in signout when deleting session info, SignOut method clears cookies but fails to remove session from db

Used with prisma postgress db and prisma adopter
Test and worked........

🧢 Checklist

  • Documentation
  • Tests
  • Ready to be merged

🎫 Affected issues

📌 Resources

Resolves the following error:


[auth][error] SignOutError: Read more at https://errors.authjs.dev#signouterror
[auth][cause]: PrismaClientUnknownRequestError:
Invalid `prisma.session.delete()` invocation:


Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(PostgresError { code: "55000", message: "cannot delete from table \"Session\" because it does not have a replica identity and publishes deletes", severity: "ERROR", detail: None, column: None, hint: Some("To enable deleting from the table, set REPLICA IDENTITY using ALTER TABLE.") }), transient: false })
    at Zr.handleRequestError (D:\Next-Js\local-store\node_modules\@prisma\client\runtime\edge.js:20:7743)
    at Zr.handleAndLogRequestError (D:\Next-Js\local-store\node_modules\@prisma\client\runtime\edge.js:20:6875)
    at Zr.request (D:\Next-Js\local-store\node_modules\@prisma\client\runtime\edge.js:20:6588)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async l (D:\Next-Js\local-store\node_modules\@prisma\client\runtime\edge.js:29:9538)
    at async r.<computed> [as deleteSession] (D:\Next-Js\local-store\.next\server\chunks\4686.js:34:52814)
    at async oE (D:\Next-Js\local-store\.next\server\chunks\4686.js:401:50161)
    at async oR (D:\Next-Js\local-store\.next\server\chunks\4686.js:401:52428)
    at async oO (D:\Next-Js\local-store\.next\server\chunks\4686.js:401:56536)
    at async tr.do (D:\Next-Js\local-store\node_modules\next\dist\compiled\next-server\app-route.runtime.prod.js:18:17582)
[auth][details]: {}
@AbdulHaseeb-1 AbdulHaseeb-1 requested a review from ndom91 as a code owner February 1, 2025 14:31
Copy link

vercel bot commented Feb 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 1, 2025 2:35pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
next-auth-docs ⬜️ Ignored (Inspect) Visit Preview Feb 1, 2025 2:35pm

Copy link

vercel bot commented Feb 1, 2025

@AbdulHaseeb-1 is attempting to deploy a commit to the authjs Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added adapters Changes related to the core code concerning database adapters prisma @auth/prisma-adapter labels Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapters Changes related to the core code concerning database adapters prisma @auth/prisma-adapter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant