prisma-binding icon indicating copy to clipboard operation
prisma-binding copied to clipboard

Calling multiple prisma requests returns same error to all the request if any one of them gives error.

Open kohakade opened this issue 5 years ago • 0 comments

When called multiple requests (Query/Mutation) to Prisma server using Promise.all, if Any one of the request gives an error like unique constraints violation the all other request stops and gives the same error even though some request are queries.

{ Error: A unique constraint would be violated on *****. Details: Field name = *****
    at BatchedGraphQLClient.<anonymous> (/*****/server/node_modules/http-link-dataloader/dist/src/BatchedGraphQLClient.js:77:35)
    at step (/*****/server/node_modules/http-link-dataloader/dist/src/BatchedGraphQLClient.js:40:23)
    at Object.next (/*****/server/node_modules/http-link-dataloader/dist/src/BatchedGraphQLClient.js:21:53)
    at fulfilled (/*****/server/node_modules/http-link-dataloader/dist/src/BatchedGraphQLClient.js:12:58)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:229:7)
  message: 'A unique constraint would be violated on *****. Details: Field name = *****',
  locations: [],
  path: [ '*****' ] }

I want to perform bulk create operation and want to perform opeartion for all even if any of them gives validation error and return summary like number successfully created, error, etc.

I also saw that some request have completed and new records are added into db but due to this isssue all records return same error.

kohakade avatar Apr 23 '19 18:04 kohakade