fix: prsima mysql template for multiple providers #12521
Closed
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.
☕️ Reasoning
Removed @unique constraint on Account.userId on Prisma MySQL documentation, because it blocks logging in if using multiple providers for the same user
[auth][error] AdapterError: Read more at https://errors.authjs.dev#adaptererror
[auth][cause]: PrismaClientKnownRequestError:
Invalid
(data)=>p.account.create()
invocation in..\mpp.next\server\chunks\node_modules_c98574._.js:4245:40
4242 id
4243 }
4244 }),
→ 4245 linkAccount: (data)=>p.account.create(
Unique constraint failed on the constraint:
Account_userId_key
at $n.handleRequestError (..\mpp\node_modules@prisma\client\runtime\library.js:121:7315)
at $n.handleAndLogRequestError (..\mpp\node_modules@prisma\client\runtime\library.js:121:6623)
at $n.request (..\mpp\node_modules@prisma\client\runtime\library.js:121:6307)
at async l (..\mpp\node_modules@prisma\client\runtime\library.js:130:9633)
at async acc. (..\mpp.next\server\chunks\node_modules_@auth_core_e8985c..js:1364:24)
at async handleLoginOrRegister (..\mpp.next\server\chunks\node_modules@auth_core_e8985c..js:2945:9)
at async Module.callback (..\mpp.next\server\chunks\node_modules@auth_core_e8985c..js:3820:50)
at async AuthInternal (..\mpp.next\server\chunks\node_modules@auth_core_e8985c..js:4859:24)
at async Auth (..\mpp.next\server\chunks\node_modules@auth_core_e8985c._.js:5120:34)
at async AppRouteRouteModule.do (..\mpp\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:10:33313)
at async AppRouteRouteModule.handle (..\mpp\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:10:40382)
at async doRender (..\mpp\node_modules\next\dist\server\base-server.js:1455:42)
at async responseGenerator (..\mpp\node_modules\next\dist\server\base-server.js:1814:28)
at async DevServer.renderToResponseWithComponentsImpl (..\mpp\node_modules\next\dist\server\base-server.js:1824:28)
at async DevServer.renderPageComponent (..\mpp\node_modules\next\dist\server\base-server.js:2240:24)
at async DevServer.renderToResponseImpl (..\mpp\node_modules\next\dist\server\base-server.js:2278:32)
at async DevServer.pipeImpl (..\mpp\node_modules\next\dist\server\base-server.js:960:25)
at async NextNodeServer.handleCatchallRenderRequest (..\mpp\node_modules\next\dist\server\next-server.js:281:17)
at async DevServer.handleRequestImpl (..\mpp\node_modules\next\dist\server\base-server.js:853:17)
at async ..\mpp\node_modules\next\dist\server\dev\next-dev-server.js:373:20
at async Span.traceAsyncFn (..\mpp\node_modules\next\dist\trace\trace.js:153:20)
at async DevServer.handleRequest (..\mpp\node_modules\next\dist\server\dev\next-dev-server.js:370:24)
at async invokeRender (..\mpp\node_modules\next\dist\server\lib\router-server.js:183:21)
at async handleRequest (..\mpp\node_modules\next\dist\server\lib\router-server.js:360:24)
at async requestHandlerImpl (..\mpp\node_modules\next\dist\server\lib\router-server.js:384:13)
at async Server.requestListener (..\mpp\node_modules\next\dist\server\lib\start-server.js:142:13)
🧢 Checklist
🎫 Affected issues
📌 Resources