Hello,
I’m attempting to fetch all metafield definitions using a filtered query. However, the API is only returning 9 items, even though a next page is available. Furthermore, when decoded from Base64, the endCursor available in the pageInfo object has the incorrect ID, it matches the ID of the 8th element instead of the final one, causing to have duplicated items when we fetch the nextPage.
query MetafieldDefinitions($ownerType: MetafieldOwnerType!, $first: Int, $query: String, $after: String, $namespace: String) {
metafieldDefinitions(ownerType: $ownerType, first: $first, after: $after, query: $query, namespace: $namespace) {
edges {
cursor
node {
id
name
namespace
key
type {
name
}
}
}
pageInfo {
endCursor
hasNextPage
}
}
}
{
"ownerType": "PRODUCT",
"first": 10,
"query": "(type:metaobject_reference) OR (type:single_line_text_field)",
"namespace": ""
}
Is this expected behaviour?
Thanks
2 Likes
Hi @Tony_Silva,
This doesn’t sound like expected behaviour, but we can certainly help look into this further to confirm, if you can please provide us with an x-request-id from the HTTP Response Headers of an example API call that experienced this behaviour.
Hello @Kellan-Shopify
Request Id: b2ae00c0-baf9-42d3-9e4b-25166bbc0773-1762207795
Thanks.
Hey @Tony_Silva, Thanks for providing the request id.
I’ve looked into this further in our logs, and I’ve also been able to replicate this exact behaviour as well with the same query used.
In my testing I’ve also noticed that this seems to only be occurring when you’re using the query filter with this API call.
If you remove the query filter from the GQL variables, you’ll see that it does return the expected 10 results, and the pagination cursor does point to the correct last result returned:
{
"ownerType": "PRODUCT",
"first": 10,
"namespace": ""
}
This seems to me like the cursor and results are being calculated before the query filter is applied, with the filter removing results after the fact.
At this time I will be discussing this behaviour further with our developers, and we will keep you updated in this thread as soon as we have any more information or when this behaviour is resolved.
Thanks for looking into it @Kellan-Shopify.
Hi @Tony_Silva,
Just wanted to follow up here and let you know that I’ve discussed this further with our developers internally, who have confirmed that this is definitely not expected behaviour and have a general understanding of why this is occurring, and will be working on a fix for this moving forward.
We can’t provide any estimates for a timeframe of resolution, but I’ll follow along with this issue internally, and keep you updated here with more info when available.