最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Graphql error: "using last without before is not supported" - Stack Overflow

programmeradmin3浏览0评论

I am using Gatsby + GraphQL + Shopify. I am having an issue retrieving my orders by the last 10.

My query looks like this:

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

And it returns this:

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

I noticed this issue happening to some other devs:

If you check the docs it says nothing about using before with last: /docs/admin-api/graphql/reference/object/order?api[version]=2020-07

There is a playground at the bottom where you can test queries.

Anybody else has seen this issue before?

I am using Gatsby + GraphQL + Shopify. I am having an issue retrieving my orders by the last 10.

My query looks like this:

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

And it returns this:

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

I noticed this issue happening to some other devs: https://munity.shopify./c/Shopify-Discussion/How-to-get-customer-s-orders-and-sort-by-date-in-descending/m-p/629133/highlight/false#M151241

If you check the docs it says nothing about using before with last: https://shopify.dev/docs/admin-api/graphql/reference/object/order?api[version]=2020-07

There is a playground at the bottom where you can test queries.

Anybody else has seen this issue before?

Share Improve this question asked Jul 6, 2020 at 22:02 NonNon 8,58920 gold badges80 silver badges130 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 18

After a few moments of playing with the playground ... you can use a workaround - reverse and first

{
  orders(first: 10, reverse:true) {
    edges {
      node {
        id
        createdAt
      }
    }
  }
}
发布评论

评论列表(0)

  1. 暂无评论