【发布时间】:2020-08-07 10:46:57
【问题描述】:
我使用 react、apollo、graphql、hasura、postgres 作为与数据库交互的堆栈。我认为我的问题很小,所以我只关注不起作用的部分,而不是发布整个代码。 谢谢。
Error: GraphQL error: unexpected variables in variableValues: birthday
at new ApolloError (bundle.esm.js:63)
at Object.next (bundle.esm.js:1004)
at notifySubscription (Observable.js:135)
at onNotify (Observable.js:179)
at SubscriptionObserver.next (Observable.js:235)
at bundle.esm.js:866
at Set.forEach (<anonymous>)
at Object.next (bundle.esm.js:866)
at notifySubscription (Observable.js:135)
at onNotify (Observable.js:179)
at SubscriptionObserver.next (Observable.js:235)
at bundle.esm.js:76
variables{ id: 2324324, name: "Fred", birthday: "1991-01-11" }
如果我删除生日,则查询有效。
这里是函数
const onUpdateUser = (options) => {
updateUser({
variables: Object.assign({ id: userId }, options),
optimisticResponse: {
__typename: "mutation_root",
update_users: {
__typename: "users_mutation_response",
affected_rows: 1,
returning: [
{
__typename: "users",
id: userId,
...options,
},
],
},
},
});
};
输入{birthday: '1991-01-11'}
【问题讨论】:
-
请提供更多导致此错误的 javascript/Apollo 代码 - 这不是 Hasura 问题,因为根据 Postgres,“1991-01-11”是有效的日期格式(在 Heroku 实例中测试w/相同的架构)。
-
我添加了功能码。
-
谢谢,请提供updateUser对应的gql突变。似乎 Hasura 报告了该错误,进一步检查:github.com/hasura/graphql-engine/blob/master/server/src-lib/…,但这并不意味着它在上游是不可预防的。
标签: postgresql graphql hasura