Bug description
When i give the value "null" to a nullable field on prisma.mymodel.create(...) i receive an error : Invalid prisma.mymodel.create() invocation. Missing a required value at...
How to reproduce
Schema:
model Sport {
name String @id
}
model NameReconciliation {
id String @default(uuid()) @id
target String
name String
sport Sport? @relation(fields: [sportId], references: [name])
sportId String?
}
So the relation Sport of NameReconciliation is nullable as in the generated prisma client :
export type NameReconciliationCreateInput = {
id?: string | null
target: string
name: string
sport?: SportCreateOneWithoutNameReconciliationInput | null
}
This is my mutation :
createNameReconciliation(root: any, { name, target, sportId }: any, ctx: Context): Promise<NameReconciliation | null> {
return ctx.prisma.nameReconciliation.create({
data: {
name,
sport: null,
target
}
})
}
So when i run this mutation in the playground :
mutation {
createNameReconciliation(name: "soccer2", target: "football") {id, name}
}
I receive :
"message": "\nInvalid prisma.nameReconciliation.create() invocation in\n/home/****/src/resolvers/reconciliate.ts:14:50
Missing a required value at Mutation.createOneNameReconciliation.data.NameReconciliationCreateInput.sport"
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"code": "P2012",
"meta": {
"path": "Mutation.createOneNameReconciliation.data.NameReconciliationCreateInput.sport"
},
"stacktrace": [
"Error: ",
"Invalid `prisma.nameReconciliation.create()` invocation in",
"/home/****/src/resolvers/reconciliate.ts:14:50",
"",
"Missing a required value at `Mutation.createOneNameReconciliation.data.NameReconciliationCreateInput.sport`",
" at PrismaClientFetcher.request (/home/****/node_modules/@prisma/client/src/runtime/getPrismaClient.ts:647:15)",
" at processTicksAndRejections (internal/process/task_queues.js:97:5)"
]
}
}
Expected behavior
I expect to just create a NameReconciliation object with the relation Sport set to null.
Prisma information
It was working before i made the update to 2.0.0-beta.5
(i was in 2.0.0-beta.1)
Environment & setup
@prisma/cli : 2.0.0-beta.5
Current platform : debian-openssl-1.1.x
OS: ArchLinux
Database: PostgreSQL
Node.js: v12.16.2
Bug description
When i give the value "null" to a nullable field on prisma.mymodel.create(...) i receive an error : Invalid
prisma.mymodel.create()invocation. Missing a required value at...How to reproduce
Schema:
So the relation Sport of NameReconciliation is nullable as in the generated prisma client :
This is my mutation :
So when i run this mutation in the playground :
I receive :
Expected behavior
I expect to just create a NameReconciliation object with the relation Sport set to null.
Prisma information
It was working before i made the update to 2.0.0-beta.5
(i was in 2.0.0-beta.1)
Environment & setup
@prisma/cli : 2.0.0-beta.5
Current platform : debian-openssl-1.1.x
OS: ArchLinux
Database: PostgreSQL
Node.js: v12.16.2