Simple Bulk Operation fails after some time with INTERNAL_SERVER_ERROR

Highlighted
Tourist
9 0 1

I have a bulk operation that a few days ago completed within 500ms  The operation retrieves all the orders in the store.  I am using a test store which only has about 10 orders.  When I run the same query now it continues to run for a while and then eventually reports an internal server error after some period of time.

mutation {
bulkOperationRunQuery(
query: """
{
orders {
edges {
node {
id
}
}
}
}
"""
) {
bulkOperation {
id
status
}
userErrors {
field
message
}
}
}

 

 

The response after some time is as follows:

 

 

 

 

{
  "data": {
    "currentBulkOperation": {
      "id": "gid://shopify/BulkOperation/62002659477",
      "status": "FAILED",
      "errorCode": "INTERNAL_SERVER_ERROR",
      "createdAt": "2020-08-27T19:07:55Z",
      "completedAt": null,
      "objectCount": "0",
      "fileSize": null,
      "url": null,
      "partialDataUrl": null
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 1,
      "actualQueryCost": 1,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 999,
        "restoreRate": 50
      }
    }
  }
}

 

 

 

 

 

Please advise. Thanks!

0 Likes
Highlighted
Shopify Staff
Shopify Staff
587 72 129

Hey @jamiealexander,

I just checked this one and it looks like the API client is missing the `read_orders` scope. Once you add that the bulk operation should complete as expected. 

If you encounter an error when using bulkOperations we recommend running the same query outside a bulkOperation, as running the query directly will yield more useful error messaging.

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

0 Likes
Highlighted
Tourist
9 0 1

Hi @_JB,

Thanks so much for looking into this.  I have included my NodeJS auth code below.  Note that I am including the `read_orders` scope.   In the past if I did not have the correct scope set I would receive an error when first making the bulk query request.  Also - this request was working fine and just stopped working two weeks ago.  I have tried requesting a new access token but I get the same results.    I have since changed over to using the non bulk query requests.  It works fine and therefore suggests the scope is set correctly.  Unfortunately this method will only tide me over as a temporary workaround.  Any additional insight would be appreciated.  Thanks, Jamie

server.use(
createShopifyAuth({
apiKey: SHOPIFY_API_KEY,
secret: SHOPIFY_API_SECRET_KEY,
scopes: ['read_products', 'write_products', 'write_orders', 'read_orders', 'write_discounts', 'read_discounts', 'write_customers', 'read_customers', 'write_script_tags'],
...

 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
587 72 129

Hey @jamiealexander,

I agree that it doesn't sound like a scope issue if the query works outside bulk ops. Would you mind trying the bulkop and direct queries again, and let me know the shop id/url and a rough timestamp from your attempts? I'll use this to check our logs and hopefully find out some more info.

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

0 Likes
Highlighted
Tourist
9 0 1
Thanks! I'll do that shortly.
0 Likes
Highlighted
Tourist
9 0 1

Hey @_JB,

Ok ... ran again and there were no issues.  I just double checked my repo to see if I had made any scope changes in between but nothing.  Any suggestions for what I should do if this happens again.  Ideally I don't wait another two weeks as it's a little late to track down in logs Thanks again for your help.

 

0 Likes