angeloashmore / gatsby-source-shopify

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

Strings as Objects #19

Open jserrao opened 6 years ago

jserrao commented 6 years ago

Strange behavior using this plugin.

I've got a pretty simple query setup to run in one of my components that receives the source data from gatsby-node.js:

  query ($handle: shopifyProductHandleQueryString_2!){
    shopifyProduct(handle: $handle) {
      title
      descriptionHtml
      handle
    }  

Every time I run it, Gatsby throws this error on every node:

Variable "$handle" got invalid value "xyz"; Expected type shopifyProductHandleQueryString_2 to be an object.

How can shopifyProductHandleQueryString_2! be both a string and an object at the same time? When I explore handle in GraphiQL, it looks to be an object of strings.

I can get the query above to work when I play with the GraphiQL query variables pane and feed it a handle object:

{
  "handle": {
    "eq": "my-term-here"
  }
}

Output looks good when I simulate this object like this code just above, but my gatsby-node.js is sending a string back in my application so it bonks. What am I missing here?