angeloashmore / gatsby-source-shopify

Source plugin for pulling product data into Gatsby from a Shopify store
36 stars 19 forks source link

"Cannot query field \"allShopifyProducts\" on type \"Query\"." #17

Closed arnaudambro closed 6 years ago

arnaudambro commented 6 years ago

Hello, Is there something I missed there ? I put the plugin in gatsby-config.js with the proper store name and token, in Shopify I toggle on the StoreFront API, and I restart gatsby develop.

Then I go to http://localhost:8000/___graphql to test a query, for example :

{
  allShopifyProducts {
    edges {
      node {
        id
      }
    }
  }
}

and what I always get is

{
  "errors": [
    {
      "message": "Cannot query field \"allShopifyProducts\" on type \"Query\".",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ]
    }
  ]
}

What did I miss ?

angeloashmore commented 6 years ago

Hi @arnaudambro, you may need to check that your products are set to display in the Storefront. When viewing the product in the backend, you can select where your product is sold under the "Product availability" section. Can you check that "Storefront" is selected?

mxmzb commented 6 years ago

This is the solution likely: https://github.com/angeloashmore/gatsby-source-shopify/issues/9#issuecomment-396079449

arnaudambro commented 6 years ago

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... Sorry about that !