I am trying for a client to build his Shopify store with Gatsby. I use for that gatsby-source-shopify2 plugin, and I always had error messages like that :
{
"errors": [
{
"message": "Cannot query field \"allShopifyProduct\" on type \"Query\".",
"locations": [
{
"line": 2,
"column": 3
}
]
}
]
}
So I investigated a bit to know what was happening, and I went on Shopify help center, followed this quick tuto and reproduced it with my client's store and with my own freshly created free test-store. Here are the step I followed :
- Create a new store, called 'my-store'
- Create a new product
- Create a new private app
- Check the box
Allow this app to access your storefront data using the Storefront API
- Copy the API key
- Double-check that the private app is checked in the
Product Availability
, just to be sure - Open GraphiQL, and set the GraphQL Endpoint to be
https://my-store.myshopify.com/api/graphql
- Set the only HTTP Header to be:
X-Shopify-Storefront-Access-Token
:<API key>
Then I typed in the query field :
{
shop {
name
}
}
And surprisingly, no error happened, but the expected output didn't come. It should have been :
{
"data": {
"shop": {
"name": "my-store",
}
}
}
I tried in gatsby too, and the same errors came again, obviously.
What is wrong with me ?