Reputation: 2653
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 :
Allow this app to access your storefront data using the Storefront API
Product Availability
, just to be surehttps://my-store.myshopify.com/api/graphql
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 ?
Upvotes: 1
Views: 1373
Reputation: 2653
OK, my mistake, I went to fast : in the private app you have many keys : <API key>
, <shared secret>
and <API Storefront access token>
. I used the <API key>
instead of the <API Storefront access token>
. Now everything is OK...
Upvotes: 1