BUG: GraphQL query returning incorrect pageinfo

Topic summary

A GraphQL query for orders is returning incorrect pageInfo values, specifically showing hasNextPage: true when only one page of results exists.

Core Issue:

  • Query with first: 20 returns 9 orders but incorrectly indicates more pages are available
  • When first: 50 is used, pagination info becomes correct
  • The bug appears when access scopes are applied; running the same query with read_all_orders scope returns correct pagination and more results (20+ orders)

Hypothesis:

  • The developer suspects pageInfo may be calculated before access scope filtering is applied, leading to misleading pagination data

Current Status:

  • Shopify Developer Support (Al) confirmed they replicated the behavior
  • Issue has been escalated to the product team with an internal ticket created
  • No timeline provided for resolution
  • A potentially related GraphQL pagination bug was referenced by another user

Technical Details:

  • Request ID provided: x-request-id: ba04b6e0-aac3-a4a7-a825-badebd08f5ac
  • Query includes filters for fulfillment location and status
  • Code snippets included for reproduction
Summarized with AI on November 14. AI used: claude-sonnet-4-5-20250929.

Hi @ShopifyDevSup

Got another graphql bug for you :slightly_smiling_face:

I have the following graphql query:

query getOrders($first: Int, $after: String, $before: String, $query: String, $last: Int) {
  orders(
    first: $first
    last: $last
    sortKey: CREATED_AT
    reverse: true
    after: $after
    before: $before
    query: $query
  ) {
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
    nodes {
      id
      name
      email
      createdAt
      displayFulfillmentStatus
      customerLocale
      shippingAddress {
        company
        address1
        address2
        city
        province
        zip
        city
        firstName
        lastName
        country
        countryCodeV2
      }
      shippingLine {
        code
      }
    }
  }
}
{
  "query": "(fulfillment_location_id:67228467415) AND (fulfillment_status:unshipped OR fulfillment_status:partial)",
  "first": 20
}

The query returns 9 orders, however the pageinfo is wrong.

{
"hasNextPage":true,
  "hasPreviousPage":false,
  "endCursor":"eyJsYXN0X2lkIjo1MjA2NzAwOTQ5NzE5LCJsYXN0X3ZhbHVlIjoxNjg2NTYzNTU4MDAwfQ==",
  "startCursor":"eyJsYXN0X2lkIjo1MjU0NzcwNTI0Mzc1LCJsYXN0X3ZhbHVlIjoxNjkxMDU3MzM3MDAwfQ=="
}

x-request-id: ba04b6e0-aa3c-4a7a-a825-bebad08f5caf

if I request 50 orders the page info is correct, in that there is only the one page of results, which also has 9 orders.

Running the query in graphiql app with read_all_orders with the same query, with first:20 I get indeed more than 20 results and the pagination is correct. If I boost the limit up to 50 (first:50) I only get 1 page of results which is also correct.

Could it be that that page_info is being calculated/generated before the access scope is being applied? I think this problem is relatively new or I think I would have noticed ..

Cheers,

Gary

Hey @garyrgilbert - this is definitely odd, thanks for the ping. I was able to replicate the behaviour on our end. I can’t say for sure what the issue is directly at the moment, but did want to touch base to mention I’m bringing this to the product team and will loop back here once I have some more info or confirmation of a fix.

Just ping us here in this thread if there’s anything we can clarify or if there are any additional details you can share - appreciate you having the request ID ready to go as well - made this super quick to dig into!

Al | Shopify Developer Support

Hey @garyrgilbert - just reaching out to confirm I’ve escalated this to the product team. I’m still unable to guarantee a turnaround time, but I can confirm we’re looking into it and have created an issue for it internally.

Thanks again for the ping on this - much appreciated.

Al | Shopify Developer Support

1 Like

Hey Al,

thanks for getting back to me with an update. Hopefully its fixed soon. I know you can’t guarantee anything but that it’s been confirmed and added as an internal ticket is still good news.

Cheers,

Gary

Hi all, I think I found a somewhat related GraphQL bug here at https://community.shopify.com/c/graphql-basics-and/bug-pageinfo-erroneously-returns-hasnextpage-true/m-p/2362092#M12235