【发布时间】:2018-09-20 10:58:52
【问题描述】:
我正在使用 Prisma GraphqQL,但在 where 选择器的突变中出现此错误: "你为用户的 where 选择器提供了一个无效的参数"
变异:
mutation UpdateUserMutation($data: UserUpdateInput!, $where: UserWhereUniqueInput!) {
updateUser(data: $data, where: $where) {
id
name
email
role
}
}
变量:
{
"data": {
"name": "alan", "email": "alan@gmail.com", "role": "ADMIN"
},
"where": {
"id": "cjfsvcaaf00an08162sacx43i"
}
}
结果:
{
"data": {
"updateUser": null
},
"errors": [
{
"message": "You provided an invalid argument for the where selector on User.",
"locations": [],
"path": [
"updateUser"
],
"code": 3040,
"requestId": "api:api:cjftyj8ov00gi0816o4vvgpm5"
}
]
}
架构:
updateUser(
data: UserUpdateInput!
where: UserWhereUniqueInput!
): User
type UserWhereUniqueInput {
id: ID
resetPasswordToken: String
email: String
}
为什么这个突变不起作用?
额外信息
本项目的完整代码是here:
Graphql Playground 是 here:
查询用户(ID:cjfsvcaaf00an08162sacx43i)。因此,可以在查询中使用“where”运算符找到用户,但不能在突变中找到。
【问题讨论】:
标签: schema graphql mutation prisma