GraphQL queries receive 'A query attribute must be specified and must be a string.'

I have a simple GitHub API GraphQL query:

query{
  viewer{
    login
    name
    isEmployee
    id
  }
    rateLimit {
    limit
    cost
    remaining
    resetAt
  }
} 

When I submit it to the GraphQL API endpoint as GraphQL, I get this error:

{ "errors": [ { "message": "A query attribute must be specified and must be a string." } ] }

However, if I simply change the request type from GraphQL to JSON — which reformats the query as Json automatically — the request succeeds.

(the automatic conversion looks like I’d expect)

{"query":"query{\n viewer{\n login\n name\n isEmployee\n id\n }\n rateLimit {\n limit\n cost\n remaining\n resetAt\n }\n} "}

Please authenticate to join the conversation.

Upvoters
Status

Needs Triage

Board

Feedback

Tags

Bug

Date

6 months ago

Author

Chris Rose

Subscribe to post

Get notified by email when there are changes.