Closed gil-- closed 6 years ago
The plugin should be very quick to fetch and process data. Using my small test shop, it took about 10 seconds.
I think this may be a result of not having any store policies since every other type of node processes successfully. Can you confirm you do not have a Return Policy, Terms & Conditions, or Privacy Policy in your store?
It's a brand new store with just some Shopify sample data so no policies were setup yet:
I generated sample data for each 3 and it now works on v1.0.1. I assume this is a bug? Otherwise we may want to document on the readme that these three fields must be generated in order to successfully use the plugin.
Ok, thanks, definitely a bug. If you have no products, this error will not show up since it iterates over an array. If the array is empty, nothing is created.
Shop policies, however, are done more directly and tries to make a node for each type of policy. If the policy is not set, the data from the API is empty, i.e. null, thus the error.
We'll have to add a check here: https://github.com/angeloashmore/gatsby-source-shopify/blob/be1880cdb8de4155bd67ef4d82c6c9751877ad5b/src/gatsby-node.js#L117-L123
type
is defined in the function, since it is hardcoded, but policy
could be null
if the policy doesn't exist.
For reference, this is the GraphQL query used to get the policies: https://github.com/angeloashmore/gatsby-source-shopify/blob/be1880cdb8de4155bd67ef4d82c6c9751877ad5b/src/queries.js#L176-L199
Getting bit by this as well. Why are you fetching my store policies by default anyways? As a source plugin shouldn't you just be providing me the connection to fetch what I'd like to fetch? Seems like default policy page generation would be something in a gatsby-plugin-shopify
or similar, no?
@coreyward Gatsby source plugins generally fetch all available data at compile time and make the data available via the GraphQL interface. So in order to make policy data available to query, the plugin needs to fetch it and create nodes containing the data.
Note that this means the data is available for you to query where ever you see fit. It does not create any pages for you.
In the future, gatsby-source-graphql will hopefully deprecate this source plugin and allow you to use the Shopify GraphQL API directly, which sounds more inline with that you're expecting the plugin to do.
Thanks for bumping this up. I'll push out a fix for this issue. 👍
Just published v1.1.1
to NPM. Could you give it a try and see if it fixes the issue? Thanks!
@angeloashmore I was able to pull down 1.1.1 and get past the error. Thank you!
Nice, thanks for testing it out! I'll close this issue, but let me know if you run into other issues.
Having issues getting gatsby to build without errors w/ v1.0.0 or v1.0.1
For reference, v0.1.9 works fine for me.
Just tried to add this source plugin to a fresh gatsby new site but having the following error on build:
gatsby develop
:gatsby-config.js
And here are the Shopify Private app settings:
And verified the token and store url are correct via graphiql:
It then seems to hang on 'source and transform nodes' unless I should be waiting 15+ minutes? ...