GraphQL api returning incorrect results

When using the graphql api to pull orders from a store every so often get a response from another query rather than the one run. This does not happen all the time as we are pulling hourly it will happen 3 times a day and is not consistent.

For example:

Query orders and get back a single row for customers from the store using the admin API.

X-REQUEST-ID:1856c402-aa52-4906-bfd3-7a0855e7192d

SHOP URL: xxxxx.myshopify.com/admin/api/2023-04/graphql.json

Hey @Pikka , this is really interesting. Most likely we are going to need to look in to our logs to best troubleshoot this. In order to do that, please reach out to one of our support teams, and make sure to reach out through the partner or merchant account that owns the app that is making the call.

If you can provide the x-request-id, timestamp, specific query that you’re making and any other relevant details, that will help us better investigate.

Thanks

  • Kyle G.

Thank you Kyle! adding details requested

Timestamp: 2023-10-19T00:00:42.113-07:00

X-REQUEST-ID:1856c402-aa52-4906-bfd3-7a0855e7192d

Query:

    query: """
      {
        orders(query:"updated_at:>=@updated_at OR created_at:>=@created_at") {
            edges {
              node {
                id
                channel {
                  app {
                    id
                    apiKey
                  }
                }
                name
                clientIp
                customer {
                  id
                }
                physicalLocation{
                  id
                }
                transactions(first: 1) {
                  formattedGateway
                }
                referrerDisplayText
                taxesIncluded
                totalPrice
                totalTax
                totalTipReceivedSet {
                  shopMoney{
                    amount
                  }
                }
                subtotalPriceSet {
                  shopMoney{
                    amount
                  }
                }
                totalDiscounts
                subtotalLineItemsQuantity
                discountCode
                currentTotalWeight
                netPayment
                processedAt
                createdAt
                tags
                test
                note
                updatedAt
                totalRefunded
                refunds {
                    id
                }
                displayFulfillmentStatus
                lineItems(first: 50) {
                  edges {
                    node {
                      id
                      product {
                        id
                      }
                      quantity
                      sku
                      taxable
                      title
                      variantTitle
                      vendor
                      originalUnitPriceSet {
                        shopMoney{
                          amount
                        }                      
                      }
                      totalDiscountSet {
                        shopMoney{
                          amount
                        }  
                      }
                    }
                  }
                }
                customerAcceptsMarketing
                shippingLine {
                  title
                  requestedFulfillmentService {
                    id
                  }
                }
                referrerUrl
                closedAt
                cancelledAt
                cancelReason
                currencyCode
                fullyPaid
                displayFinancialStatus
              }
            }
          }
      }
    """
  ) {
    bulkOperation {
      id
      status
    }
    userErrors {
      field
      message
    }
  }
}'''

Hey @Pikka , you still may need to reach out to our support team so we can securely look in to the specifics.

Looking at this generally though, I do see that this is a bulk operations query.

Since you mentioned you’re getting the response from a previously run query instead of the current one I would make sure to take a look at how you are retrieving the data. For example, one thing to double check is that the ID of the currentBulkOperation you’re retrieving matches the ID that is returned in the response.

For further troubleshooting, you can also try a node query for your bulkOperation ID to see if the same URL is returned. It could look something like this:

{
node(id: “gid://shopify/BulkOperation/[BulkOperationID]”) {
… on BulkOperation {
status
errorCode
url
partialDataUrl
}
}
}

If both of those ID’s match, but you’re getting a jsonL content from a previous request or the same URL from a previous request, then we would for sure want to take a closer look. Reaching out through our Support is going to be best here for a more in-depth investigation!

Thanks.

  • Kyle G.

Thank you Kyle we will investigate on our side with what you have mentioned and reachout through support if still having issues.