Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

GraphQL Mutation Error: Timeout but Still Updates Products - Where does it stop?

GraphQL Mutation Error: Timeout but Still Updates Products - Where does it stop?

stats_marketing
Shopify Partner
26 3 15

I am load testing updating available quantities per location using the new InventorySetOnHandQuantities  for the 2023-01 API Release.

 

Keep getting this response every so often because of the large data loads: 

 

 

{"errors":[{"message":"Timeout","extensions":{"code":"TIMEOUT"}}]}

 

 

 

Example of large data load:

{mutation ( $input1: InventorySetOnHandQuantitiesInput!
			$input2: InventorySetOnHandQuantitiesInput!
			$input3: InventorySetOnHandQuantitiesInput!
			$input4: InventorySetOnHandQuantitiesInput!
			$input5: InventorySetOnHandQuantitiesInput!
			$input6: InventorySetOnHandQuantitiesInput!
			$input7: InventorySetOnHandQuantitiesInput!
			$input8: InventorySetOnHandQuantitiesInput!
			$input9: InventorySetOnHandQuantitiesInput!
			$input10: InventorySetOnHandQuantitiesInput!
			$input11: InventorySetOnHandQuantitiesInput!
			$input12: InventorySetOnHandQuantitiesInput!
			$input13: InventorySetOnHandQuantitiesInput!
			$input14: InventorySetOnHandQuantitiesInput!
			$input15: InventorySetOnHandQuantitiesInput!
			$input16: InventorySetOnHandQuantitiesInput!
			$input17: InventorySetOnHandQuantitiesInput!
			$input18: InventorySetOnHandQuantitiesInput!
			$input19: InventorySetOnHandQuantitiesInput!
			$input20: InventorySetOnHandQuantitiesInput!
			$input21: InventorySetOnHandQuantitiesInput!
			$input22: InventorySetOnHandQuantitiesInput!
			$input23: InventorySetOnHandQuantitiesInput!
			$input24: InventorySetOnHandQuantitiesInput!
			$input25: InventorySetOnHandQuantitiesInput!
			$input26: InventorySetOnHandQuantitiesInput!
			$input27: InventorySetOnHandQuantitiesInput!
			$input28: InventorySetOnHandQuantitiesInput!
			$input29: InventorySetOnHandQuantitiesInput!
			$input30: InventorySetOnHandQuantitiesInput!
			$input31: InventorySetOnHandQuantitiesInput!
			$input32: InventorySetOnHandQuantitiesInput!
			$input33: InventorySetOnHandQuantitiesInput!
			$input34: InventorySetOnHandQuantitiesInput!
			$input35: InventorySetOnHandQuantitiesInput!
			$input36: InventorySetOnHandQuantitiesInput!
			$input37: InventorySetOnHandQuantitiesInput!
			$input38: InventorySetOnHandQuantitiesInput!
			$input39: InventorySetOnHandQuantitiesInput!
			$input40: InventorySetOnHandQuantitiesInput!
			$input41: InventorySetOnHandQuantitiesInput!
			$input42: InventorySetOnHandQuantitiesInput!
			$input43: InventorySetOnHandQuantitiesInput!
			$input44: InventorySetOnHandQuantitiesInput!
			$input45: InventorySetOnHandQuantitiesInput!
			$input46: InventorySetOnHandQuantitiesInput!
			$input47: InventorySetOnHandQuantitiesInput!
			$input48: InventorySetOnHandQuantitiesInput!
			$input49: InventorySetOnHandQuantitiesInput!
			$input50: InventorySetOnHandQuantitiesInput!
			...
			){  mutation1: inventorySetOnHandQuantities(input: $input1) {
				inventoryAdjustmentGroup {
				  id
				  reason
				}
				userErrors {
				  field
				  message
				}
			}
			    mutation2: inventorySetOnHandQuantities(input: $input2) {
				inventoryAdjustmentGroup {
				  id
				  reason
				}
				userErrors {
				  field
				  message
				}
			 }
			 .....

Each variable set contains 250 in each:

 

{
  "input1": {
    "reason": "restock",
    "setQuantities": [
      {
        "inventoryItemId": "gid://shopify/InventoryItem/42668819644464",
        "locationId": "gid://shopify/Location/63640764464",
        "quantity": 999
      },
      {
        "inventoryItemId": "gid://shopify/InventoryItem/42668819644464",
        "locationId": "gid://shopify/Location/63640797232",
        "quantity": 999
      },
      {
        "inventoryItemId": "gid://shopify/InventoryItem/42668819644464",
        "locationId": "gid://shopify/Location/63628902448",
        "quantity": 999
      },
...
]
},
"input2": {
    "reason": "restock",
    "setQuantities": [
      {
        "inventoryItemId": "gid://shopify/InventoryItem/42668819644464",
        "locationId": "gid://shopify/Location/123456789",
        "quantity": 999
      },
...

 

When I get the `Timeout` error I check the inventory of products and it it still updated some of the products inventories.

 

1)  How do I know which products got updated or where does it stop?

 

2)  How do I account for the Timeout error? 

- I have sent 40 mutations and it worked, the next time I did it, I got the Timeout Error.  So sometimes it works, sometimes it doesn't?

- Clearly I would just send only a certain amount of mutations at a time, but how can I figure that out?

 

 

Replies 0 (0)