thunder
thunder copied to clipboard
mutation always returns "unknown field"
When I run mutations on the /example server (e.g. addMessage or addReaction) using Insomnia as client, I always get the error "unknown field ..."
This is the mutation that I send
mutation {
addMessage(text: "hi there")
}
Is there something wrong with the syntax (Insomnia can read the schema and gives me nice type-ahead suggestions) or does Thunder expect a different mutation style?
same here
I use code as in example, but result is following
obj := schema.Mutation()
obj.FieldFunc("echo", func(args struct{ Message string }) string {
return args.Message
})
curl 'localhost:8088/graphql' -XPOST --data-binary '{"query":"mutation{ echo(message:\"test\")}","variables":{}}'
{"data":null,"errors":["unknown field \"echo\""]}
same here, it has to do with newlines before the mutation for me, I'm using the builtin graphiql client
mutation ($authorId: string!, $parentEntityId: string!, $parentCommentId: string!, $body: string!, $eventId: string!, $estimatedTime: Time!) {
addComment(authorId: $authorId, parentEntityId: $parentEntityId, parentCommentId: $parentCommentId, eventId: $eventId, estimatedTime: $estimatedTime, body: $body) {
id
body
}
}
I get
{
"state": "error",
"error": "unknown field \"addComment\""
}
I had the same error with the simple echo
example. Removing the comments on top of the request fixed this. I suspect there's something going on with the comment parsing ?
Related #103 and probably fixed by dcb9587
I am using the sample echo function and Insomnia client, always got unknown field "echo", any suggestion how to fix this?
Did you try to remove the comments above the sample echo function?
After upgrading to the latest code, this has been fixed, thanks