GraphQL get bulkOperation by ID missing and currentBulkOperation for mutations always returning NULL

Hi all,

I’ve been able to successfully start bulk mutations through the GraphQL API. I’ve verified the changes being propagated to my products.

However, I’ve noticed two things:

  1. GraphQL seems to be missing a ‘get bulkoperation status by ID’ query. There seems to be an example here (https://shopify.dev/docs/api/usage/bulk-operations/imports#wait-for-the-operation-to-finish) something along the lines of:
query {
  node(id: "gid://shopify/BulkOperation/206005076024") {
    ... on BulkOperation {
      url
      partialDataUrl
    }
  }
}

But I’m not sure how to run this query as there is only a currentBulkOperation query in the documentation.

  1. After starting a bulk mutation (which I’ve verified takes ~10 minutes) and running the following query in the Shopify GraphQL App, the API always returns a null value even though I can verify a MUTATION is running. Has someone else seen this as well?
{
  currentBulkOperation(type: MUTATION) {
    id
    createdAt
    completedAt
    status
    url
  }
}

Note type: QUERY does work correctly, so there seems to be something wrong here.

I’m not sure how anyone is able to use these bulk mutations at all reliably here. For me, the currentBulkOperation seems to be not working for MUTATIONs and I’m also not able to query specific passed mutations at all.

The interesting thing is, in the imports documentation a note is added:

Webhook delivery isn’t always guaranteed, so you might still need to poll for the operation’s status to check when it’s finished.

But, how can this be done if there is no get bulkoperation status by ID query?

Can anyone help me in the right direction here?

So, I’ve finally figured out what happened here.

Apparently, this is a valid GraphQL query:

query {
  node(id: "gid://shopify/BulkOperation/206005076024") {
    ... on BulkOperation {
      url
      partialDataUrl
    }
  }
}

This means, there is actually an inadequatly documented way to query bulk operations by ID. This solves issue 1.

My problem (issue 2) came from starting the bulk mutation from my private app (with it’s own API key) and trying to query this bulk operation from the Shopify GraphQL app (which has it’s own API key and permissions). In hindsight, it makes sense I was not able to view the bulk operation status through the GraphQL app.

3 Likes

You beaut!

1 Like

Thanks to this post, because i was missing in the documentation.

1 Like

legend! Thanks for coming back and updating your post. Massive help.

1 Like