Fluent API Issue When Using rejectOnNotFound
#8929
Labels
bug/2-confirmed
Bug has been reproduced and confirmed.
kind/bug
A reported bug.
team/client
Issue for team Client.
topic: fluent api
topic: rejectOnNotFound / *OrThrow
Bug description
I'm attempting to use
rejectOnNotFound
to return an Error whenfindUnique()
doesn't return an instance for a given model. My understanding is thatrejectOnNotFound
is concerned with the main model and not it's relations, so if a relation isnull
, I'd expect no Error to be thrown. I believe it's an issue with the Fluent API. Discussion here.How to reproduce
Have a repo here: https://github.com/tnolan8/urql-prisma
The problem stems from the following setup:
In the above if I call
findUnique()
with a User that exists but doesn't have anInfo
object associated it throws and error, resulting in something like:Expected behavior
Field Resolver returns with no Errors when User exists but doesn't have an associated relation.
Prisma information
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: