bulkOperationRunQuery returning userErrors "Bulk query is not valid GraphQL" due to updated syntax

Highlighted
Shopify Partner
7 0 1

We haven't made any changes on our end and it was working as-is prior to last night, so as of yesterday (6/1) there appears to be have been an update to the bulkOperationRunQuery query syntax. I figured I would post here incase anyone is running into the same problem or searching for a resolution.


We originally migrated our code from making multiple GraphQL query calls to use and benefit from bulkOperations; however, we had some remnant syntax in our code which appears to have worked up until last night.

Our api call to run a bulk operation query started returning the user error "Bulk query is not valid GraphQL":

{"userErrors":[{"field":["query"],"message":"Bulk query is not valid GraphQL"}]}


This is a slimmed down version of the actual query we were using:

 mutation {
  bulkOperationRunQuery(
    query:"""
    {
      productVariants() {
        edges {
          node {
            id
            displayName
            barcode
            product {
              collections() {
                edges {
                  node {
                    title
                  }
                }
              }
            }
          }
        }
      }
    }        
    """
  ) {
    bulkOperation {
      id
      status
    }
    userErrors {
      field
      message
    }
  }
}


This will error due to the parenthesis on "collections()". As I mentioned this was left over from our original query where we used to pass additional parameters in, but worked up until last night.

Simply removing the "()" from collections fixed our bulkOperationRunQuery.
 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
587 71 128

Hey @krchun,

 

Thanks for the post. The expected syntax for a bulk query shouldn't include the parenthesis, but I can definitely see how those could be left over when constructing the query. Hopefully this helps someone else as well.

JB | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes