Runtime error that occurs in findUnique()
when unique constraint is composed of one field
#24241
Labels
bug/2-confirmed
Bug has been reproduced and confirmed.
domain/client
Issue in the "Client" domain: Prisma Client, Prisma Studio etc.
kind/bug
A reported bug.
topic: typescript
topic: validation
Bug description
After configuring the schema as shown below(Prisma information), the
userId
set as aunique constraint
was mapped to whereArgs offindUnique()
. There is no type error or compile error, but the following error occurs at runtime.The
Test_userId_unique_constraint
mentioned here does not currently exist inTestWhereUniqueInput
. (Please refer to the prisma information below). As a result, a type error occurs when trying to applyTest_userId_unique_constraint
to the where condition only. (As a result of my testing,id
andTest_userId_unique_constraint
are not set to Where condition. If you pass it together, the type error seems to be avoided. However, I don't want to use the unique condition while passing the id like this). In fact, if you useuserId
(defined as unique), the type error does not occur. However, as mentioned earlier, a more serious runtime error occurs.How to reproduce
Please check prisma information part
Expected behavior
No response
Prisma information
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: