Bulk operation fail a lot admin graphql api

Hi,

I have a very big problem, my bulk operations fails very often and it fails more and more often, I use admin graphql api 2022-10 version

query:

mutation {
      bulkOperationRunQuery(
        query: """
        {
            orders(query: "created_at:>='2023-01-13T00:00:00Z' AND created_at:<'2023-01-14T00:00:00Z'") {
            edges {
              node {
                id
                name
                createdAt
                displayFinancialStatus
                email
                note
                discountCode
                tags
                app{
                  name
                }
                customAttributes {
                  key
                  value
                }
                currentTotalPriceSet {
                  shopMoney {
                    amount
                    currencyCode
                  }
                }
                currentSubtotalPriceSet {
                  shopMoney {
                    amount
                    currencyCode
                  }
                }
                totalDiscountsSet {
                  shopMoney {
                    amount
                    currencyCode
                  }
                }
                paymentGatewayNames
                refunds {
                  id
                }
                billingAddress{
                  firstName
                  lastName
                  phone
                  address1
                  address2
                  countryCodeV2
                  zip
                  city
                }
                shippingAddress {
                  firstName
                  lastName
                  phone
                  address1
                  address2
                  countryCodeV2
                  zip
                  city
                }
                customer {
                  firstName
                  lastName
                  email
                  phone
                  defaultAddress {
                    phone
                    address1
                    address2
                    zip
                    city
                  }
                }
                lineItems {
                  edges {
                    node {
                      id
                      sku
                      name
                      quantity
                      currentQuantity
                      discountAllocations {
                        discountApplication {
                          allocationMethod
                          targetSelection
                          value
                        }
                        allocatedAmountSet {
                          shopMoney {
                            amount
                            currencyCode
                          }
                        }
                      }
                      discountedUnitPriceSet {
                        shopMoney {
                          amount
                          currencyCode
                        }
                      }
                      originalUnitPriceSet{
                        shopMoney {
                          amount
                          currencyCode
                        }
                      }
                    }
                  }
                }
                shippingLines {
                  edges {
                    node {
                      id
                      title
                      discountedPriceSet {
                        shopMoney {
                          amount
                          currencyCode
                        }
                      }
                    }
                  }
                }
                metafields{
                  edges{
                    node{
                      id
                      key
                      value
                      namespace
                    }
                  }
                }
              }
            }
          }
        }              
        """
      ) {
        bulkOperation {
          id
          status
        }
        userErrors {
          field
          message
        }
      }
    }

returns:

body: {
    data: {
      node: {
        id: 'gid://shopify/BulkOperation/1585437114504',
        status: 'FAILED',
        url: null,
        errorCode: 'INTERNAL_SERVER_ERROR',
        objectCount: '0'
      }
    }

I have seen someone returning back to 2022-07 version but it didn’t work for me ( this is my 2022-07 version attempt but it does same on 2022-10)

please can someone help on this?

Please do someone know someting about this?

I have more examples (those are version 2022-10):

node: {
        id: 'gid://shopify/BulkOperation/1595741372552',
        status: 'FAILED',
        url: null,
        errorCode: 'INTERNAL_SERVER_ERROR',
        objectCount: '0'
      }
node: {
        id: 'gid://shopify/BulkOperation/1595814969480',
        status: 'FAILED',
        url: null,
        errorCode: 'INTERNAL_SERVER_ERROR',
        objectCount: '0'
      }

Hi @AW1234,

If you are encountering the same issue on the 2022-07 and 2022-10 versions of the Admin API then the errors are probably not related to access to protected customer data with your app.

Bulk Operation errors can be tricky because they do not surface specific details on where an error was raised, but I would recommend you start troubleshooting by limiting the amount of data requested.

  • Since you are already filtering the results down to a 24 hour time period with the created_at filter parameter, the next step would be to try removing return fields from query to determine if the operation can run successfully without requesting specific fields or connections on the order objects.

Alternatively, you could try querying the same data with an HTTP client like Postman or Insomnia outside of a bulk operation, and following the cursors to see if you can narrow down where the errors are coming from and adjusting your bulk operation inputs form there.

Hope that helps.

2 Likes

Thank you but I haven’t had any error since you posted this answer (same request), so I’m just going to wait a day when I’ll have ann error again and try this.

Hi,

It’s been a long time haha,

I re-reply because I had this problem today again on V2023-01

I think it happens when I do too many request with the same IP in the same day (I did a lot today)

1 Like

Hi @AW1234 ,

Looking at the original example query there’s a ā€˜metafields’ section, and metafields can be unpredictable in size so one suggestion is to try without the metafields part and see if that helps, maybe querying for them separately.

Aside from that we’d need a recent specific example to try find more info, and encourage submitting [a support request to Partner Support] to help maintain privacy if further assistance is required.

Hope you have a great day

Hi,

I have the same problem today with this query:

mutation {
    bulkOperationRunQuery(
        query:"""
        {
         orders(query:"created_at:>=${date.toLocaleDateString('en-CA')} AND (fulfillment_status:shipped OR fulfillment_status:partial)"){
          edges{
            node{
              fulfillments{
                id
                displayStatus
                trackingInfo{
                  number
                }
              }
            }
          }
        }
      }
      """
    ) {
      bulkOperation {
        id
        status
      }
      userErrors {
        field
        message
      }
    }
  }

I also tried it only with the ā€œidā€ field in ā€œfulfillmentsā€ and I still have a failed status

{
  body: {
    data: {
      node: {
        id: 'gid://shopify/BulkOperation/3322983776586',
        status: 'FAILED',
        url: null,
        errorCode: 'INTERNAL_SERVER_ERROR',
        objectCount: '0'
      }
    },
    extensions: {
      cost: {
        requestedQueryCost: 1,
        actualQueryCost: 1,
        throttleStatus: {
          maximumAvailable: 10000,
          currentlyAvailable: 9999,
          restoreRate: 500
        }
      }
    }
  }

I think I will do the support request thanks