Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
🎫 Affected issues
📌 Resources