Not able to check the status of bulk operation mutations

I am trying to check the status of bulk operation mutation that I have created previously.

when I try to check it using following gql from the GraphiQl interface, it gives me null. [the id in following gql is just a placeholder, its not actual id]

query CheckBulkOperationStatus{
  node(id: "gid://shopify/BulkOperation/99999999999999"){
    ... on BulkOperation{
      id
    }
  }
}

OR

query {
 currentBulkOperation(type: MUTATION) {
    id
    status
    errorCode
    createdAt
    completedAt
    objectCount
    fileSize
    url
    partialDataUrl
 }
}

when I try using following gql from my admin(using end point “shopify:admin/api/graphql.json”) it gives me an error:

query CheckBulkOperation($id: ID!) {
  node(id: $id) {
    ... on BulkOperation {
      id
      status
      type
      createdAt
      completedAt
      errorCode
      url
      objectCount
      fileSize
    }
  }
        }

error is as below (replaced the actual id with placeholder)

{
    "errors": [
        {
            "message": "Internal error. Looks like something went wrong on our end.\nRequest ID: <<long-id>> (include this in support requests).",
            "extensions": {
                "requestId": "<<long-id>>",
                "code": "INTERNAL_SERVER_ERROR"
            }
        }
    ],
    "data": null
}

Any one else having same issue? I am reaching out to support as well

A merchant can only have one bulk operation running at a time.

So instead of trying to pass an ID to a generic node field, just use currentBulkOperation as the field on the query root:

  query {
    currentBulkOperation {
      id
      status
      errorCode
      createdAt
      completedAt
      objectCount
      fileSize
      url
      partialDataUrl
      query
      type
    }
  }

Hey @Dylan
I just tried as per your suggestion, it still gives me null.

Have you checked the userErrors of your currentBulkOperation query?

Perhaps there’s an error with the request, or missing scope or some other issue.

1 Like

yeah…I checked it, and the error message I have added in my initial post is the exact massage I got as a response to api call.

one surprising thing is, if I make call from GraphiQl editor, it response with null, but if I make call using direct api request from my code, it return error.

I don’t think its issue with missing scopes, because the mutation is running properly, and I can see all the changes reflected to data as per the mutation

Hey @Chirag :waving_hand: would you be able to share an x-request-id from the API response headers we send back to you when you make the API call in your app that returns the INTERNAL_SERVER_ERROR message?

I can take that ID and run a search in our logs to narrow down what might be happening. Hope to hear from you soon!

Hey @Alan_G thanks for your message, luckily the issue is now fixed.
Solution is: use same access token(only online or only offline) to create bulk operation and check the status of it.

Here is the summary:

I was creating new bulk operation in the backend using offline access token
then I was checking it in the client by fetch request on url “shopify:admin/api/graphql.json”, and I believe it is using online access token.

The issue resolved as soon as I moved my gql query to the backend, where I am using same access token to create and check the status of the bulk operation.

The problem is “I was using different access token to check the status”, Natalie O from Shopify support helped me to identify the issue.

Thank you all.

1 Like

Glad this is working for you now @Chirag and thanks for posting your solution. Let us know if you run into any other issues!

2 Likes