findMany
with a select
argument errors out with models with self-relations (sometimes)
#2442
Labels
bug/2-confirmed
Bug has been reproduced and confirmed.
kind/bug
A reported bug.
tech/engines
Issue for tech Engines.
Milestone
Bug description
The "sometimes" is dependent on the order of scalars with respect to the self relation in the
select
argument. Details follow.@kunovsky originally discovered this in their schema, I've managed to narrow down the problem.
How to reproduce
(Note that the
User
field was automatically added by the VSCode extension)prisma migrate save --experimental && prisma migrate up --experimental
index.ts
file in the folder, paste this:Expand
ts-node index.ts
.Okay I needed you to copy & paste the script above because the issue seems to only happen when a scalar field is after the self-relation in the
select
argument. Yeah...A few other things of value:
select
argument entirely, then the script does not crashselect.updatedByUser
argument, then the script does not crashselect.updatedBy
argument, then the script does not crashselect.registryAccessToken
argument above theselect.updatedByUser
argument, then the script does not crash :Pselect.registryAccessToken
withselect.name
orselect.active
, then the script DOES crash, albeit with a different error message (it looks similar though).Here are the GraphQL queries generated:
select: { updatedBy: true, updatedByUser: true, active: true }
(Crashes)select: { updatedBy: true, updatedByUser: true, active: true }
(Scalar before relation, does not crash)select: { updatedBy: true, active: true }
(Removed relation, does not crash)Expected behavior
select
arguments should not determine if the script crashes or notEnvironment & setup
The text was updated successfully, but these errors were encountered: