get-graphql-schema icon indicating copy to clipboard operation
get-graphql-schema copied to clipboard

Syntax Error GraphQL request (1:2) Expected Name, found String \"query\"

Open jeffgardnerdev opened this issue 7 years ago • 2 comments

I'm getting this error when running the following command: get-graphql-schema -h Authorization=$AUTH_TOKEN https://my.graphql.endpoint.com > schema.graphql

Here is the full error output:

Error: [
  {
    "message": "Syntax Error GraphQL request (1:2) Expected Name, found String \"query\"\n\n1: {\"query\":\"\\n  query IntrospectionQuery {\\n    __schema {\\n      queryType { name }\\n      mutationType { name }\\n      subscriptionType { name }\\n      types {\\n        ...FullType\\n      }\\n      directives {\\n        name\\n        description\\n        locations\\n        args {\\n          ...InputValue\\n        }\\n      }\\n    }\\n  }\\n\\n  fragment FullType on __Type {\\n    kind\\n    name\\n    description\\n    fields(includeDeprecated: true) {\\n      name\\n      description\\n      args {\\n        ...InputValue\\n      }\\n      type {\\n        ...TypeRef\\n      }\\n      isDeprecated\\n      deprecationReason\\n    }\\n    inputFields {\\n      ...InputValue\\n    }\\n    interfaces {\\n      ...TypeRef\\n    }\\n    enumValues(includeDeprecated: true) {\\n      name\\n      description\\n      isDeprecated\\n      deprecationReason\\n    }\\n    possibleTypes {\\n      ...TypeRef\\n    }\\n  }\\n\\n  fragment InputValue on __InputValue {\\n    name\\n    description\\n    type { ...TypeRef }\\n    defaultValue\\n  }\\n\\n  fragment TypeRef on __Type {\\n    kind\\n    name\\n    ofType {\\n      kind\\n      name\\n      ofType {\\n        kind\\n        name\\n        ofType {\\n          kind\\n          name\\n          ofType {\\n            kind\\n            name\\n            ofType {\\n              kind\\n              name\\n              ofType {\\n                kind\\n                name\\n                ofType {\\n                  kind\\n                  name\\n                }\\n              }\\n            }\\n          }\\n        }\\n      }\\n    }\\n  }\\n\"}\n    ^\n",
    "locations": [
      {
        "line": 1,
        "column": 2
      }
    ]
  }
]
    
at /node_modules/get-graphql-schema/dist/index.js:83:31
at step (/node_modules/get-graphql-schema/dist/index.js:33:23)
at Object.next (/node_modules/get-graphql-schema/dist/index.js:14:53)
at fulfilled (/node_modules/get-graphql-schema/dist/index.js:5:58)
at process._tickCallback (internal/process/next_tick.js:109:7)

With Postman, requests with GraphQL syntax get a successful response, but when trying JSON syntax ({ "query": "...", "variables": null, "operationName": null }) it gives the same error as above.

jeffgardnerdev avatar Oct 12 '17 17:10 jeffgardnerdev

You got the solution ?

nkarre avatar Jul 23 '18 07:07 nkarre

Any luck? I've got the same problem now.. think it might have arisen when I began using InputObjects in Graphene. I need to roll back to before I implemented them to test this hypothesis though.

EDIT: I think I found the problem. It looks like it has to do with nested InputObjects.

EDIT2: Nope it looks more like it has to do with graphene.DataTime(default_value=maya.now().datetime()) in my graphene.InputObjectType.

usmcamp0811 avatar Mar 12 '20 12:03 usmcamp0811