Open AssisrMatheus opened 4 years ago
I noted that this only happen if "computedInputs" is added to nexusPrismaPlugin()
Any update on this, I just encountered this issue as well
Yup! this is ugly. Can't use 'computedInputs' option on nexusPrismaPlugin().
I spent a brief amount of time looking at this. The problem appears to be that src/builder.ts
in the buildCRUD
method checks for Mutation
and then if there are any local or global computed inputs, it calls the dmmf/transformer.ts
function addComputedInputs
to add them. The problem is that addComputedInputs
returns them as a data
argument which is not supported for some mutation operations. Of note, even if you comment out the adding of the global inputs, it still returns an empty data: { }
and that causes a failure as well (though that wouldn't be a valid solution).
If you comment out the call to addComputedInputs
in buildCRUD
the problem goes away, but of course that isn't the right answer as it stops computed inputs from working at all for any mutation. I added a quick condition on the mutation operation (mappedField.operation
) to see if it was running an operation that doesn't support data: { }
and that made it all work for me, but it feels like a hack since it doesn't cover the root computedInput field (such as your object ID on delete
) and also seems like the wrong way to determine which operations support data
arguments (hard coded operations rather than something more abstract). Therefore I have not done a PR for this...
Hope this helps find the right solution.
My
t.crud.upsertOneXXXX
andt.crud.deleteOneXXXX
operations are throwing this error:It seems that at
\node_modules\nexus-prisma\src\dmmf\transformer.ts
line 181 it doesparams.args.data
.data
doesn't exist when we are deleting an entity nor when we're upserting. Upserting usescreate
andupdate
args but not adata
one, and delete has none.This also happens with deleteMany. Update and create works fine.