Michael Plaxico
06/25/2022, 5:50 PMfindUnique and no records match my query, I get an internal server error. I can’t even prevent this from happening by specifying rejectOnNotFound: false. It happens to matter what.
Invalid `prisma.product.delete()` invocation:
An operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.
Error:
Invalid `prisma.product.delete()` invocation:
An operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.
at RequestHandler.request (/Users/meh/codebase/blah/blah-api/node_modules/@prisma/client/runtime/index.js:49022:15)
at PrismaService._request (/Users/meh/codebase/blah/blah-api/node_modules/@prisma/client/runtime/index.js:49919:18)
at ProductsService.deleteProduct (/Users/meh/codebase/blah/blah-api/src/products/products.service.ts:27:12)
at ProductsResolver.deleteProduct (/Users/meh/codebase/blah/blah-api/src/products/products.resolver.ts:45:12)
at target (/Users/meh/codebase/blah/blah-api/node_modules/@nestjs/core/helpers/external-context-creator.js:77:28)
at /Users/meh/codebase/blah/blah-api/node_modules/@nestjs/core/helpers/external-proxy.js:9:24Tasin Ishmam
06/26/2022, 3:27 AMdelete call and not findUnique based on the logged info.
delete raises a PrismaClientKnownRequestError when the record does not exist.
Perhaps you could show the relevant code? Maybe you’re accidentally calling the wrong function.Michael Plaxico
06/26/2022, 4:28 PMdist directory and recompiling the application did the trick.Tasin Ishmam
06/26/2022, 10:14 PM