Closed dhoulker closed 4 years ago
I also had issues with the 2020-01 API, I reverted to the previous version that also supports cursor based pagination.
@dhoulker nextPageParameters
and previousPageParameters
are non enumerable properties attached to the returned array.
Hello, I've got the same issue, I've copied the pagination example from the readme but when i'm looping through let say 10 orders each, it stops at the first time because it nextPageParameters
is undefined.
(async () => {
let params = { limit: 10, fulfillment_status: 'unshipped', financial_status: 'paid', status: 'open' };
do {
console.log('loop');
const orders = await shopify.order.list(params).catch((err) => console.error(err));
// do stuff
params = orders.nextPageParameters;
console.log(orders.nextPageParameters); // Logs undefined
} while (params !== undefined);
})().catch(console.error);
Check the shopify-api-node
version. The feature is only supported on version 2.24.0 and above.
I'm using 3.0.0
From my package.json:
"shopify-api-node": "^3.0.0"
What version of the API are you using? Cursor based pagination is only supported on API version 2019-07 and above.
The same version as @dhoulker
2020-01
I have no idea. Try to monkey patch the code and log res.headers.link
https://github.com/MONEI/Shopify-api-node/blob/066c49589c9cee5290089773bd52e45406956604/index.js#L153
to see if the Link
header is received.
Also try to use the 2019-10 API version as suggested by @jbgrunewald.
I didn’t have the time to root cause the issue, but I can give you an overview of what I saw.
I was running 25.2.1 of the client and tried using the 2020-01 API version. I tested upgrading Node versions for the 3.X.X client, and had the same issues. When I rolled back to the 2019-07 API the issue with cursor based pagination was resolved. This also worked on the 25.2.1 client, so I skipped the node upgrade for now.
James Grunewald
On Mar 15, 2020, at 10:05 AM, Luigi Pinca notifications@github.com wrote:
Also try to use the 2019-10 API version as suggested by @jbgrunewald.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Having the same issue here even just testing the pagination example in the readme. I've tried using 3.3.0 and 2.25.1, as well as the 2019-07, 2019-10 and 2020-01 Shopify API versions, and params
returns undefined
in all cases. I can only get back the number of products determined by the limit
. Any other suggestions here?
Figured it out. My Shopify API version is not updating in real time, not sure what the expected delay is supposed to be but I assumed it was instant. I added the apiVersion
option manually to the shopify
instance and set it to 2019-10
. ie:
const shopify = new Shopify({
shopName: process.env.SHOP_NAME,
apiKey: process.env.API_KEY,
password: process.env.PASSWORD,
apiVersion: '2019-10'
});
Does shopify-api-node not use the API version chosen in the private app settings?
AFAIK if you don't specify the API version it will use the oldest supported version.
Figured it out. My Shopify API version is not updating in real time, not sure what the expected delay is supposed to be but I assumed it was instant. I added the
apiVersion
option manually to theshopify
instance and set it to2019-10
. ie:const shopify = new Shopify({ shopName: process.env.SHOP_NAME, apiKey: process.env.API_KEY, password: process.env.PASSWORD, apiVersion: '2019-10' });
Does shopify-api-node not use the API version chosen in the private app settings?
This did the trick for me, had to specify api version. Thanks so much!
Closing due to inactivity. Discussion can continue if needed.
Hello,
I can see Cursor based pagination is supported, but when i call
order.list({limit:2})
(for example) i don't see any previous or next page parameters, just an array of orders.I've set the api version to
2020-01
Is there anything else i need to do?
Thanks,
Dave