Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

GraphQL counterinuitive situation with no cursor available

GraphQL counterinuitive situation with no cursor available

TjadiPeeters
Shopify Partner
2 0 4

Hi Shopify,

 

Hope you are doing well. Would just like to report a somewhat counterintuitive result I have found using the graphQL API. What I have noticed is that if you have the read_orders scope (so can retrieve only orders from the last 60 days) and create a query using a updated_date, it does not show the results from the first order that you are allowed to see. Example:

 

 

{results:orders(query:"updated_at:>=2021-06-22 00:00:00", first: 4%s) {
            orders:edges {
              cursor
              order:node {
                id
                createdAt
                cancelledAt
                updatedAt
                cancelReason
                displayFinancialStatus

 

 

 

Will give the following result:

 

 

{'data': {'results': {'orders': [], 'pageInfo': {'hasNextPage': True}}},
 'extensions': {'cost': {'requestedQueryCost': 794,
   'actualQueryCost': 2,
   'throttleStatus': {'maximumAvailable': 1000.0,
    'currentlyAvailable': 998,
    'restoreRate': 50.0}}}}

 

 

 

This is of course a bit counterintuitive, as there is a next page, but due to the order not being visible/ allowed to be retrieved, you do not have a cursor that you can use to paginate forward to orders that you are allowed to see (I checked and using just first : 4 does work). I think a more standard expected result would be the query giving the first available orders. 

 

Kind regards,

 

Tjadi

Replies 0 (0)