thunder icon indicating copy to clipboard operation
thunder copied to clipboard

mutation always returns "unknown field"

Open henningwagner opened this issue 6 years ago • 8 comments

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?

henningwagner avatar Aug 29 '18 07:08 henningwagner

same here

urakozz avatar Sep 12 '18 14:09 urakozz

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\""]}

yurykozyrev avatar Sep 17 '18 15:09 yurykozyrev

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\""
}

obad2015 avatar Sep 24 '18 11:09 obad2015

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 ?

depado avatar Oct 09 '18 13:10 depado

Related #103 and probably fixed by dcb9587

depado avatar Oct 10 '18 09:10 depado

I am using the sample echo function and Insomnia client, always got unknown field "echo", any suggestion how to fix this?

haihxiao avatar Feb 19 '19 12:02 haihxiao

Did you try to remove the comments above the sample echo function?

depado avatar Feb 19 '19 14:02 depado

After upgrading to the latest code, this has been fixed, thanks

hhxiao avatar Feb 20 '19 00:02 hhxiao