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

FetchError: invalid json response body at http://localhost:4000/graphql reason: Unexpected token < in JSON at position 0

Open romenigld opened this issue 4 years ago • 3 comments

I'm trying a $ get-graphql-schema http://localhost:4000/graphql > ./schema.graphql And complain for this:

FetchError: invalid json response body at http://localhost:4000/graphql reason: Unexpected token < in JSON at position 0
    at /Users/romenigld/.asdf/installs/nodejs/12.13.1/.npm/lib/node_modules/get-graphql-schema/node_modules/node-fetch/lib/index.js:272:32
    at processTicksAndRejections (internal/process/task_queues.js:93:5) {
  message: 'invalid json response body at http://localhost:4000/graphql reason: Unexpected token < in JSON at position 0',
  type: 'invalid-json'
}

romenigld avatar Mar 10 '20 23:03 romenigld

I believe that you are getting an HTML response. Check the actual response body.

stefanwille avatar Mar 11 '20 07:03 stefanwille

I have the same problem My response is in JSON .

jessielaf avatar Jul 11 '20 11:07 jessielaf

See my comment here: https://github.com/prisma-labs/get-graphql-schema/issues/29#issuecomment-1068410112

odigity avatar Mar 15 '22 19:03 odigity