Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
***Edit***
The problem seems to have solved itself. I assume it was a temporary issue with the graphql server
****
When requesting a collection and it's products from the storefront API, The first query is successful and will return the correct results, but when I request the second page (first N products after end cursor), this error is returned: "message": "Invalid cursor for current pagination sort."
Here is an example of an initial query and result:
query CollectionByHandle($handle: String!) {
collectionByHandle(handle: $handle) {
handle
id
products(first: 3, filters: {productType: "Vinyl Decal"}) {
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
edges {
node {
id
handle
availableForSale
title
}
}
}
}
}
and the initial result:
{
"data": {
"collectionByHandle": {
"handle": "outdoors",
"id": "gid://shopify/Collection/471395467548",
"products": {
"pageInfo": {
"endCursor": "eyJsYXN0X3ZhbHVlIjoiMiIsImxhc3RfaWQiOjkzOTUxNDk0MzkyNjB9",
"hasNextPage": true,
"hasPreviousPage": false,
"startCursor": "eyJsYXN0X3ZhbHVlIjoiMCIsImxhc3RfaWQiOjkzMzQ3NTkyMjc2NzZ9"
},
"edges": [
{
"node": {
"id": "gid://shopify/Product/9334759227676",
"handle": "trippy-magic-skull-decal",
"availableForSale": true,
"title": "Trippy Magic Skull - Decal - Customizable"
}
},
{
"node": {
"id": "gid://shopify/Product/9395147145500",
"handle": "bird-flowers-decal",
"availableForSale": true,
"title": "Bird & Flowers - Decal"
}
},
{
"node": {
"id": "gid://shopify/Product/9395149439260",
"handle": "graphite-flower-decal",
"availableForSale": true,
"title": "Graphite Flower - Decal"
}
}
]
}
}
}
}
But, if I then request the next page:
query CollectionByHandle($handle: String!) {
collectionByHandle(handle: $handle) {
handle
id
products(
first: 3
filters: {productType: "Vinyl Decal"}
after: "eyJsYXN0X3ZhbHVlIjoiMiIsImxhc3RfaWQiOjkzOTUxNDk0MzkyNjB9"
) {
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
edges {
node {
id
handle
availableForSale
title
}
}
}
}
}
This I receive this error:
{
"data": {
"collectionByHandle": null
},
"errors": [
{
"message": "Invalid cursor for current pagination sort.",
"locations": [
{
"line": 5,
"column": 5
}
],
"path": [
"collectionByHandle",
"products"
]
}
]
}
It was all behaving as expected when I last used it 2 days ago, and as of this morning, this error has started to appear. I may be missing something, and if I have left out any info I can try to provide it. Any insight would be appreciated, thanks
I'm having the same issue on collection query, and it seems like the issue only happened to CREATED product sort key
Yeah, I edited my post too soon. I queried by product type, which worked, and I mistook it for a collection query which is still returning an error with the CREATED sort key
Did anything come of this? We are having the issues with the 'load more' button not pulling more products. It works fine if the filters are not used, is this the same issue you are having, or is it different? We believe the issue is related to the shopify storefront API and we are getting the error message, "Invalid cursor for current pagination sort." when using filters in a product query.
is it fixed?
Yes, that is the same issue I'm experiencing. I haven't found a fix for it.
We did get it fixed on our end - we had some custom logic in there to have the second page on down load by new to old when filters were applied.
Same issue in our store. Only happen when applying at the same time sort by CREATED (asc or desc) and any filter.
The issue is happening for one of my stores as well, preventing basic functionality. @Shopify do you have an API health status monitor?
It seems to be working as expected now for us. Nothing changed on our end otherwise, so I guess it's fixed for the time being.
I contacted Shopify Plus support. They pushed out a fix for this last night which appears to have resolved the issue