Graphql error: "using last without before is not supported"

Graphql error: "using last without before is not supported"

我正在使用 Gatsby + GraphQL + Shopify。我在检索过去 10 点之前的订单时遇到问题。

我的查询如下所示:

query {
   customer(customerAccessToken: "${customerAccessToken}") {
      orders(last: 10) {...}
   }
}

它returns这个:

"message": "using last without before is not supported"

我注意到这个问题发生在其他一些开发者身上:https://community.shopify.com/c/Shopify-Discussion/How-to-get-customer-s-orders-and-sort-by-date-in-descending/m-p/629133/highlight/false#M151241

如果您查看文档,它并没有说明将 beforelast 一起使用: https://shopify.dev/docs/admin-api/graphql/reference/object/order?api[version]=2020-07

底部有一个 playground,您可以在其中测试查询。

其他人以前见过这个问题吗?

在游乐场玩了一会儿之后...您可以使用 解决方法 - reversefirst

{
  orders(first: 10, reverse:true) {
    edges {
      node {
        id
        createdAt
      }
    }
  }
}