prisma-labs / get-graphql-schema

Fetch and print the GraphQL schema from a GraphQL HTTP endpoint. (Can be used for Relay Modern.)
669 stars 62 forks source link

Error with JSON #29

Open JohnieXu opened 5 years ago

JohnieXu commented 5 years ago

error like this

{ FetchError: invalid json response body at http://localhost:18000/graphiql reason: Unexpected end of JSON input
    at /Users/johniexu/.nvm/versions/node/v10.13.0/lib/node_modules/get-graphql-schema/node_modules/node-fetch/lib/index.js:241:32
    at process._tickCallback (internal/process/next_tick.js:68:7)
  message:
   'invalid json response body at http://localhost:18000/graphiql reason: Unexpected end of JSON input',
  type: 'invalid-json' }

graphiql server created by postgraphifle, when i run get-graphql-schema http://localhost:18000/graphiql > schema.graphql, I got error

warcayac commented 3 years ago

Same problem? Any answers?

odigity commented 2 years ago

Would be nice if I could actually see the JSON that it's choking on. Would be nice if there was a debug or verbose flag for that.

BTW - In my case the error was caused by the CSRF protection in Django as explained here, but it would have been easier to determine the problem if I could see the HTML that get-graphql-schema was attempting to parse as JSON.