Why the last filter doesn't work? Error: "using last without before is not supported"

maketroli
Tourist
3 0 3

I am trying to use last: 10 to get the last 10 orders.

The query:
customer(customerAccessToken: "${customerAccessToken}") {
    orders(last: 10) {...}
}
returns: "message": "using last without before is not supported"
 
Even here https://shopify.dev/docs/admin-api/graphql/reference/object/order?api[version]=2020-07 on the playground at the bottom, change first and set last instead so you will see the error I mentioned.
 
 
{
  orders(first: 10, reverse:true, sortKey:CREATED_AT) {
    edges {
      node {
        id
        createdAt
      }
    }
  }
}
But (first:10, reverse:true) is not equal to (last:10), imagine you have 20 data [1,2,3....17,18,19,20] The 1st approach will return [10,9,8,7...3,2,1] while the 2nd will return [20,19,18....12,11,10].
 
Am I wrong? The point is that we need support for last. In the DOCs says we only need to use last with no other keys present.
 
Replies 4 (4)

dylanpierce
Shopify Partner
215 3 98

Also experiencing the same bug with the below query:

            {
              orders(last: 10) {
                edges {
                  node {
                    id
                    email
                    name
                    phone
                  }
                }
              }
            }

 

But, the same query works in the  GraphQL explorer Shopify app. 

Founder of Real ID - Verify your customer's real IDs easily & securely with modern A.I.

Want to see it in action? Check out our demo store.

johnAirRobe
Shopify Partner
6 1 2

I'm getting the same issue for the following query which according to the documentation I can use:

 query {
  currentAppInstallation {
    allSubscriptions(last: 2) {
      edges {
        node {
          lineItems {
            plan {
              pricingDetails {
                __typename
                ... on AppRecurringPricing {
                  price {
                    amount
                    currencyCode
                  }
                }
                ... on AppUsagePricing {
                  balanceUsed {
                    amount
                    currencyCode
                  }
                  cappedAmount {
                    amount
                    currencyCode
                  }
                }
              }
            }
          }
          createdAt
          id
          name
          status
          test
        }
      }
    }
  }
}

 

Ettiene
Shopify Partner
5 0 10

Frustrating to hear no comment or solution on this problem. Im starting to have doubts on the seriousness of the shopify team and the truthfulness of their obfuscated documentation

Picstick
Visitor
1 0 0

I get the same issue.

Actually, if you do  

orders(first:10, reverse: true, sortKey: Storefront.OrderSortKeys.processedAt) { ...

then it's equal to last: 10

 

Strangely the reverse is doing the opposite sorting. You can check if by last: 1, and see which order returns...