Orders are missing in GraphQL

aleksei_s_popov
Visitor
3 0 6

Hi, I am Aleksei from Supermetrics.

 

We encountered an issue with a list of our clients shops. It seems that GraphQL API is not returning the expected data, although REST API does.

 
For example:

Shop in question - the-gin-project.myshopify.com

Dates – 2021-12-01 – 2021-12-31

 

REST API seems to return correct orders for all days.
GraphQL doesn‘t return data for 01-04 and 06-12 days. For 5th day it returns two orders. From the 13th it looks like all orders are returned correctly. So for almost half of the moth data is missing with GraphQL.

Single day REST API query with orders returned:
https://the-gin-project.myshopify.com/admin/api/2021-07/orders.json?created_at_min=2021-12-01T00:00:00+00:00&created_at_max=2021-12-01T23:59:59+00:00

 

Same day GraphQL query with zero orders in result:
https://the-gin-project.myshopify.com/admin/api/2021-07/graphql.json
mutation {
  bulkOperationRunQuery(
   query: """
    {
      orders(query:"test:false created_at:>='2021-12-01T00:00:00' created_at:<'2021-12-01T23:59:59'") {
        edges {
          node {
            id
          }
        }
      }
    }
    """
  ) {
    bulkOperation {
      id
      status
    }
    userErrors {
      field
      message
    }
  }
}

 

Bulk operation response:
{
    "data": {
        "node": {
            "id": "gid://shopify/BulkOperation/...",
            "status": "COMPLETED",
            "errorCode": null,
            "createdAt": "2022-01-10T10:30:49Z",
            "completedAt": "2022-01-10T10:30:49Z",
            "objectCount": "0",
            "fileSize": null,
            "url": null,
            "partialDataUrl": null
        }
    },
    "extensions": {...}
}

 

At some point there were orders in the result for 01-07 days when requested separately fore ach day. When requested for whole month, these days had zero orders. Days 08-12 didn‘t  returned any orders even when requested separately. And, as mentioned before, currently even daily requests do not return orders for provided days.

 


UPDATE:
The issue was solved for the-gin-project.myshopify.com . After emailing to support. But we see same problems with lost of other shops - orders are missing from GraphQL:

for example: 
the-gin-project.myshopify.com - Although the problem affecting December was fixed after email to support, now customers are seeing that August and September data is incorrect.
vineapparel-com.myshopify.com - Jan to November 2021 data is all busted.
tailored-athlete-usa.myshopify.com - data for the year 2021 (up until around period between January through until November) is busted
tailored-athlete-clothing.myshopify.com - data for the year 2021 (up until around period between January through until November) is busted

 

We believe this might be a major bug on Shopify API side.

 

Any insight is appreciated

Replies 9 (9)

aleksei_s_popov
Visitor
3 0 6

@Josh might be you could help us with this issue?

taxdoo29
Visitor
2 0 2

Thank you. We have the same problem here. The responses show an erratic behaviour, some/multiple retries get some missing orders while some don't. Does Shopify know or have a notice that they are aware of this problem?

GabrielDev
Visitor
1 0 0

Any updates regarding this topic?
@aleksei_s_popov 

mikerowave
Shopify Staff (Retired)
22 3 2

Hi @aleksei_s_popov!

 

According to our docs, there should be a Z character at the end of a date-time string within a query search. The date-time values in your query would need to read as created_at:>='2021-12-01T00:00:00Z' and created_at:<'2021-12-01T23:59:59Z' respectively in order to return anything.

 

Additionally I see that you're attempting this as a bulk query. I would generally recommend testing if something works as a single query first. In this case you know you're only trying to get orders from a single day so a regular API call would suffice. Upon understanding the search query syntax and getting some results from a working query, then you can wrap it in a bulk query.

Mike M (mikerowave) | API Support @ Shopify 
 - Was my reply helpful? Click Like to let me know!
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit shopify.dev or the Shopify Web Design and Development Blog

taxdoo29
Visitor
2 0 2

Hi @mikerowave we are already using the date-time string with the Z and still have the same problem as @aleksei_s_popov . Even when I try to query any of the missing shopify orders directly, the response from shopify has no order details in the edges section of the response. We also believe this might be a major bug on Shopify's side.

mikerowave
Shopify Staff (Retired)
22 3 2

Hi @taxdoo29!

Order details wouldn't exist in the edges but rather a node. An edge describes a type of connection between nodes and typically, unless you specifically need edge metadata like a cursor for example, it is recommended that you use nodes instead of edges { nodes. Our docs use them interchangeably though so be aware!

That being said, would you mind sharing your query so I can take a look?

Mike M (mikerowave) | API Support @ Shopify 
 - Was my reply helpful? Click Like to let me know!
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit shopify.dev or the Shopify Web Design and Development Blog

ms_stryker
Visitor
3 0 0

We have a similar issue, the following query will return orders that are 3 days old, but will not return orders sooner than that:

 

 

query ($query:String) {
    orders(first:10, query: $query) {
        pageInfo {
            hasNextPage
            endCursor
        }
        nodes {
            legacyResourceId
            createdAt
            updatedAt
        }
    }
}
{
    "query": "created_at:>=2023-06-02T18:34:18Z AND created_at:<2023-06-05T18:34:20Z"
}

 

 

ShopifyDevSup
Shopify Staff
1432 234 488

Hey @ms_stryker - thanks for getting in touch. From what I can see, this is a little odd, the query variables you defined should return any orders created within that date range. Could you reach out to Shopify Support directly through https://help.shopify.com/ or directly through your partner dashboard (if you are a Shopify Partner)? I would include this thread here in your message. 

If you're able to include an X-Request-ID in the message (this would be included in the Response Headers for the API call that is included in the response from Shopify), this would be helpful for us to track down what could be happening here. Since we'd likely be dealing with some shop-specific private information while troubleshooting, the next best step is to reach out to our internal support teams. They should be able to get in touch with our more technical teams (like my team, API Support) in order to help troubleshoot this. 

Hope this helps - hope to hear from you soon. 

Al | Shopify Developer Support

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

ms_stryker
Visitor
3 0 0

Yes, I was able to eventually get it working by wrapping the timestamps in single quotes like this: 

 

"created_at:>='2023-06-05T19:19:17Z' AND created_at:<'2023-06-05T19:19:18Z'"