Cannot fetch both Product and Variant Metafields using the bulkOperationRunQuery mutation in GraphQL

DanAtBonify
Shopify Partner
54 4 32

Using BulkOperations I am able to pull down Product Metafields OR Variant Metafields just fine. When trying to fetch Products, Product Metafields, Variants, and Variant Metafields all at the same I always get an INTERNAL_SERVER_ERROR code, with the operation failing. The operation does not fail instantly, the objectCount goes up many thousands before failing. Sometimes the partialDataUrl value is set, but not always.

 

Failed IDs (if helpful): gid://shopify/BulkOperation/1122730056, gid://shopify/BulkOperation/1123090504

 

Here is essentially what that query is doing:

 

{
  products {
    edges {
      node {
        ...fields
        metafields {
          edges {
            node {
              ...fields
            }
          }
        }
        variants {
          edges {
            node {
              ...fields
              metafields {
                edges {
                  node {
                    ...fields
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

 

I am unsure if this is an issue related to my query or a limitation of the Graph API.

 

Also, this seems to happen given any number of products, e.g. 40 or 1600 products

Replies 2 (2)

hassain
Shopify Staff (Retired)
624 104 187

Hey @DanAtBonify 

 

Hey @DanAtBonify 

 

That is very interesting that you appear to be consistently getting this error. As a test I have run your exact same BulkOperations query for my own personal Shopify Store (with replacing your `...fields` Fragment to just be the field of `id` only - however please correct me if this assumption is wrong), and I was able to get a successfully completed report with all of my queried data. So from my perspective the issue does not appear to be with your specific query or bulk querying Products, Product Metafields, Variants, and Variant Metafields all at the same time, but rather the issue would most likely come from your volume of data or something else specific to your store.  

 

Could you please provide the value of the "X-Request-ID" header from the GraphQL API Response? With this ID I can look through the logs to see if I can find more information as to why your BulkOperations query seems to always be getting an INTERNAL_SERVER_ERROR

 

To learn more visit the Shopify Help Center or the Community Blog.

DanAtBonify
Shopify Partner
54 4 32

Hello, thank you for investigating this issue.

 

Some other people from Shopify replied in a Slack channel where I posted this and were saying it was likely an issue related to cursor pagination with products->variants.

 

From Graham Cooper:

What is happening is that at some point during the query, the queries we are generating are breaking. It’s not a problem specifically with the Bulk Operation, its a problem with variants and we have contacted the appropriate team about it...

 

... There is an issue for it being tracked. The problem stems from how we make additional calls in graphql for nested connections. This requires thenodesquery and so when we are trying to query additional items past the first page on a product we have to specify the cursor for the next page of variants and that is currently what is broken. ie something like:node(id: "myproudctid") { … Product { variants(first: 10, cursor: "abcde") { edges { node { id } } } } }will fail.

Hopefully when the issue is fixed we can be notified here because we are building some app features that are dependent on BulkOperations working for this query. Thanks again for looking into this!!