I am using graphql-js-schema-fetch
to fetch Shopify schema, but it throws an error and I do not know how to fix it.
Using CLI:
graphql-js-schema-fetch https://myspati-com.myshopify.com/api/graphql --header "Content-Type: application/graphql" --header "X-Shopify-Storefront-Access-Token: <acces-token>"
This is the error:
{
"errors": [{
"message": "Parse error on "query" (STRING) at [1, 2]",
"locations": [{
"line": 1,
"column": 2
}]
}]
}
Anyone with experience here?
3
Answers
I had to remove "Content-Type" and Access-Token and replace it with the Shopifys credentials. Now it works for me.
Try changing the
Content-Type
toapplication/json
.This works for me despite all the docs saying to use
application/graphql
The only solution that worked for me was:
If you want the download file into a SDL format instead of JSON use this approach:
Apollo client will conside the output as a SDL format: