GraphQL throws internal server error for bulk request

Shopify Partner
8 0 0

Hi,

I am building an APP which provides bulk editing functionality using GraphQL endpoints. But after some interval it throws errors in result. Here is one sample of error.

 

 RESULT = {"errors":[{"message":"Internal error. Looks like something went wrong on our end.\nRequest ID: f0e86cef-5500-41ae-8c6f-3d4ff4bb172c (include this in support requests)."}]}.

 

Any help is greatly appreciated.

 

0 Likes
Shopify Staff
Shopify Staff
1028 68 135

Hey @majidzulfiqar , 

 

How often are you seeing this occur? It looks like a database timeout occurred in our logs which can happen at times when we're under heavy load or a database becomes unhealthy for some reason. Given that you appear to have only been adding a single product to a relatively small collection, there wouldn't have been a way to avoid this aside from re-trying the call again. Would I be correct in assuming trying to add the same product again worked?

1 Like
Shopify Partner
8 0 0

Thanks Josh for your reply! Retrying that request was always the second solution for this problem.

 

Apart from this, it happens normally when we send requests in bulk like out of 60 requests it fails for 4-5 requests on average. 

We are testing on development stores for now. Can it be related to this? 

 

0 Likes
Shopify Staff
Shopify Staff
1028 68 135

Hey again @majidzulfiqar , 

 

It shouldn't be related to the type of shop, while development shops do have some actions throttled at levels lower than a production shop would, that wouldn't apply here. 

 

How quickly are you sending these 60 requests, out of curiosity? I'd like to attempt to replicate this.

0 Likes
Shopify Partner
8 0 0

Hey @Josh 

 

As we are updating inventory in bulk or adding products in collections, so at top we are sending these 60 requests in almost 3 sec.

Below are some sample requests that we are sending and each request cost is around 11. 

 

mutation{    collectionAddProducts(      id: "gid://shopify/Collection/77545799755"      productIds:["gid://shopify/Product/1489629413451"]    )    {      collection{        id      }      userErrors{        message        field      }    }  }
mutation{    collectionAddProducts(      id: "gid://shopify/Collection/77545799755"      productIds:["gid://shopify/Product/1489629446219"]    )    {      collection{        id      }      userErrors{        message        field      }    }  }

mutation {  inventoryActivate(    inventoryItemId:"gid://shopify/InventoryItem/31015005519947"    locationId: "gid://shopify/Location/14115995723"    available: 12)  {          userErrors {      field      message    }  }}
mutation {  inventoryActivate(    inventoryItemId:"gid://shopify/InventoryItem/31015002964043"    locationId: "gid://shopify/Location/14115995723"    available: 12)  {          userErrors {      field      message    }  }}

 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
1028 68 135

Hello again @majidzulfiqar , 

 

Adding several products with multiple API calls to a collection could potentially cause what you're seeing, especially depending on the size of the collection. Adding products to a collection triggers additional jobs to 'rebuild' the collection and a lot of these being fired at the same time could definitely create some database load and some timeouts. 

 

Would it be possible to add multiple products in the same mutation to reduce the number of calls required?

0 Likes