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

Topic summary

Developers are encountering an error when using the last parameter in Shopify’s GraphQL API to retrieve the most recent orders: “using last without before is not supported”.

Core Issue:

  • Attempting queries like orders(last: 10) fails despite documentation suggesting this should work
  • The error occurs in both the Storefront API and Admin API
  • Multiple users report the same problem across different query contexts (customer orders, app subscriptions)

Attempted Workarounds:

  • Using first: 10, reverse: true, sortKey: CREATED_AT appears to work but returns results in opposite order [1,2,3...10] instead of [20,19,18...11]
  • The reverse parameter behaves unexpectedly, not providing true equivalence to last

Current Status:

  • Unresolved - No official response or solution from Shopify
  • Users express frustration about lack of clarity between documentation and actual API behavior
  • Question remains whether this is a bug, undocumented limitation, or documentation error
Summarized with AI on November 10. AI used: claude-sonnet-4-5-20250929.

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.

I posted the question on SO https://stackoverflow.com/questions/62765178/graphql-error-using-last-without-before-is-not-supported/62772930?noredirect=1#comment111020049_62772930 and that’s the answer I got.

{
  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.

DOCs: https://shopify.dev/docs/admin-api/graphql/reference/object/customer?api[version]=2020-07

3 Likes

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.

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
        }
      }
    }
  }
}

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

1 Like

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…