Gatsby: [gatsby-source-shopify] Products limited to 250

Created on 13 Feb 2019  路  6Comments  路  Source: gatsbyjs/gatsby

Description

Shopify restricts node edges to 250 per query, this project seems to have missed this feature so only the first 250 products are returned.

Issue is brought up here: https://github.com/angeloashmore/gatsby-source-shopify/issues/1#issuecomment-426396621

Steps to reproduce

  • Hook gatsby-source-shopify into a store with over 250 products, attempt to find the data.
  • Alternatively, create a collection, attach products 251+ to that collection, gatsby will fail to build as it is unable to link (find) the products in that collection

Expected result

All products should be indexed

Actual result

Error: Invariant Violation: Encountered an error trying to infer a GraphQL type for: "products___NODE". There is no corresponding node with the id field matching:

Environment

System: OS: macOS High Sierra 10.13.6 CPU: (4) x64 Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz Shell: 5.3 - /bin/zsh Binaries: Node: 11.6.0 - /usr/local/bin/node Yarn: 1.13.0 - /usr/local/bin/yarn npm: 6.5.0 - /usr/local/bin/npm Languages: Python: 2.7.15 - /usr/local/bin/python Browsers: Chrome: 71.0.3578.98 Firefox: 62.0 Safari: 12.0.3 npmPackages: gatsby: ^2.0.115 => 2.0.115 gatsby-image: ^2.0.29 => 2.0.29 gatsby-link: ^2.0.10 => 2.0.10 gatsby-plugin-google-analytics: ^2.0.6 => 2.0.13 gatsby-plugin-layout: ^1.0.12 => 1.0.12 gatsby-plugin-react-helmet: ^3.0.6 => 3.0.6 gatsby-plugin-sass: ^2.0.10 => 2.0.10 gatsby-plugin-sharp: ^2.0.20 => 2.0.20 gatsby-source-filesystem: ^2.0.20 => 2.0.20 gatsby-source-shopify: ^2.0.13 => 2.0.13 gatsby-transformer-sharp: ^2.1.13 => 2.1.13 npmGlobalPackages: gatsby-cli: 2.4.9

confirmed bug

Most helpful comment

I'll try something else - I will try to add limit (definitely lower than 250) to queries (if shopify api support that) to force multiple "pages" and make sure all products (and possibly other queries) will fetch as long as there is next page available

All 6 comments

Do you know if there sample shopify shop we can use to reproduce this (and test fix with)

https://help.shopify.com/en/partners/dashboard/development-stores

Looks like a development store will need to be set up. When I get some free time I'll look into getting it sorted.

I'll try something else - I will try to add limit (definitely lower than 250) to queries (if shopify api support that) to force multiple "pages" and make sure all products (and possibly other queries) will fetch as long as there is next page available

Ok, changing limit seems to trigger cascade of errors - I have fix and will be opening PR shortly. Would you be willing to test it with your store that have >250 products? I can prepare packed package that you will be able to install

You're a legend.

Yeah can do.

Here's PR - https://github.com/gatsbyjs/gatsby/pull/11752

you can try this locally by:

npm install https://github.com/pieh/test-package-tarballs/raw/master/gatsby-source-shopify-250-fix-1.tgz

or

yarn add https://github.com/pieh/test-package-tarballs/raw/master/gatsby-source-shopify-250-fix-1.tgz`
Was this page helpful?
0 / 5 - 0 ratings