How to use Pagination alog with Data limit

I am trying to query shipments with Pagination, but I also want to use the data limit to limit 30 shipments per request. However, what I notice is that ShipHero does not return the link to next cursor when I use data limit. Any suggestions. Please see a sample request I am making.

query {
orders(
warehouse_id: “V2XXXXXXXXXXXXODY=”
fulfillment_status:“fulfilled”
updated_from: “2020-11-06”
) {
request_id
complexity
data(first: 5) {
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
edges {
node {
id
legacy_id
order_number
partner_order_id
fulfillment_status
order_date
auto_print_return_label

I know for the fact there are about 75 Shipments so I am expecting ShipHero to give me link to next page. However, this is what I see. Note that has next page is false.

“data”: {
“orders”: {
“request_id”: “5faXXXXXXXXX21f”,
“complexity”: 101,
“data”: {
“pageInfo”: {
“hasNextPage”: false,
“hasPreviousPage”: false,
“startCursor”: “YXXXXXXXXXXXXjA=”,
“endCursor”: “YXXXXXXXXXXjE=”
},
“edges”: [
{
“node”: {
“id”: “T3JkXXXXXXXXYz”,
“legacy_id”: 1XXXXXX3,
“order_number”: “8XXXXXX20”,
“partner_order_id”: “8XXXXXX20”,

The reason we want to limit number of records per request is that way we consume far less credits. We noticed that as soon as we remove the data limit, ShipHero consumes all credits we have irrespective of how may documents are returned. Is there something I am not dong correct here?

HI @goutham!
Is there any chance you could include the request_id ?
That way I would be able to access the full query, check the data that it will be pulling, and evaluate if this could be optimized in some way.
Thanks in advance!
Tom

Hi Tomas
Thanks for offering to help. Please see the request id below.
“data”: {
“orders”: {
“request_id”: “5faac56acdb476b348047a1c”,
“complexity”: 101,
“data”: {
“pageInfo”: {
“hasNextPage”: false,
“startCursor”: “YXJyYXljb25uZWN0aW9uOjA=”,
“endCursor”: “YXJyYXljb25uZWN0aW9uOjE=”
},

Hi Tomas
Did you get a chance to look at the request_id I sent?

Hi @goutham!
I apologize for my delayed response to this.
I made a ticket for our engineers to take a look at it, it seems to be related to the warehouse_id filter on the Query.

In the meantime, you can try removing the warehouse_id, that should not return you any inconsistencies.
I noticed that you also have just one warehouse, so for that purpose, it should be fine.

Let me know if that wouldn’t work for you.
Thanks again!
Tom

Something like this:

query {
  orders(
    fulfillment_status: "fulfilled"
    updated_from: "2020-11-06"
    updated_to: "2020-11-07"
  ) {
    request_id
    complexity
    data(first: 5) {
      pageInfo {
        hasNextPage
        startCursor
        endCursor
      }
      edges {
        node {
          id
          legacy_id
          order_number
          partner_order_id
          fulfillment_status
          order_date
          auto_print_return_label
          account_id
          packing_note
          required_ship_date
          ignore_address_validation_errors
          source
          tags
          holds {
            fraud_hold
            address_hold
            shipping_method_hold
            operator_hold
            payment_hold
          }
          shipments {
            id
            legacy_id
            order_id
            user_id
            warehouse_id
            pending_shipment_id
            address {
              name
              address1
              address2
              city
              state
              country
              zip
              phone
            }
            shipped_off_shiphero
            created_date
            shipping_labels {
              id
              tracking_number
              carrier
              shipping_name
              shipping_method
              cost
              warehouse
              carrier_account_id
              source
              created_date
            }
          }
          order_history {
            created_at
            information
            user_id
          }
          line_items(first: 10) {
            edges {
              node {
                sku
                quantity
                quantity_allocated
                quantity_pending_fulfillment
                backorder_quantity
                fulfillment_status
                shipped_line_item_lots {
                  id
                  line_item_id
                  lot_id
                  lot_name
                  lot_expiration_date
                }
              }
              cursor
            }
          }
        }
        cursor
      }
    }
  }
}

And also by including a updated_to: “2020-11-07” filter might be handy

Hi Tomas
Looks like we have run into another Pagination issue.
If you look at this request id :5fc5b9a0dd472dac2f5d802f. The query we ran for first 500 records returns hasNextpage as false

I ran the same query by reducing the page count to first 300 pages and as expected hasNext is now true as seen below
request id : 5fc5ba23e60095f8f649f2e2


Now I am using the endCursor and getting the next set of pages. Ideally, I should get no more than 200 more records, but I keep on getting hasNext page true indefinitely like an endless loop.
Here are the request for next few executions with endCursor
5fc5ba960ddcdaf69e9f8264
5fc5bac58b4f0d7bfffc0a0c
5fc5badd1b025cd3310fc358

Hi @goutham!
My apologies for the delayed response about this.

I see you are only including the from filter (updated_from) but not updated_to, which in your case if your 3PL is currently fulfilling orders it might happen that the end cursor by the time you query, it might not match the “real” one.

Sounds like this would be the case? and if you include the updated_to it keeps happening (this endless loop)?

Thanks again!
Tom