PrismaP
Prisma11mo ago
8 replies
deanStealth

unique constraint failed on where column? how is possible?

In production, once in a while our customer gets an error on the backend """Invalid prisma.trainerProposalXrefDbo.update() invocation: Unique constraint failed on the fields: (id)"""

on the following code """ const promise1 = txClient.trainerProposalXrefDbo.update({ where: { id: trainerPropXref.id, proposal_id: trainerPropXref.proposal_id }, data: { stage: TrainerProposalStageEnum.CONFIRMED } });"""

How is this even possible? I could undertstand violation of a uniqueness column if in the data block but not the where block. I am not sure the stack trace helps
at qn.handleRequestError (/home/node/app/server/node_modules/@prisma/client/runtime/library.js:121:7315) at qn.handleAndLogRequestError (/home/node/app/server/node_modules/@prisma/client/runtime/library.js:121:6640) at qn.request (/home/node/app/server/node_modules/@prisma/client/runtime/library.js:121:6347) at l (/home/node/app/server/node_modules/@prisma/client/runtime/library.js:130:9616) at async Promise.all (index 0) at /home/node/app/server/src/controllers/customer/customerController.ts:987:13 at Proxy._transactionWithCallback (/home/node/app/server/node_modules/@prisma/client/runtime/library.js:130:7983) at CustomerController.runTransactionToAdd (/home/node/app/server/src/controllers/customer/customerController.ts:868:31) at CustomerController.confirmBook (/home/node/app/server/src/controllers/customer/customerController.ts:824:25) at /home/node/app/server/src/controllers/customer/customerApiRouting.ts:123:45
Was this page helpful?