API product update error: "This product is currently being modified"

API product update error: "This product is currently being modified"

Arkadi
Tourist
4 0 4

When trying to update products via GraphQL, sometimes it succeeds, sometimes it's not. But whenever fails, it's NOT because of `429` too many requests or over-usage, it is rather due to a VERY STRANGE error which goes like this:

"This product is currently being modified. Please try again later." with the internal code of "TOO_MANY_PARALLEL_REQUESTS_FOR_THIS_PRODUCT"

 
now, what does that mean? why is that shown up? the GraphQL mutation used is "productAppendImages".
I would also like to note that sometimes it succeeds, sometimes it doesn't - and I can't find any pattern for the failures. Final note - in the logic of completely updating the product, previous to this query being run, there's another query run, but with REST API, which 100% succeeds. i.e, in chronological order:
1) some REST API call to update a product is being made
2) the request succeeds
3) a GraphQL "productAppendImages" mutation is being called
4) about 50% of times it fails and complains with this weird aforementioned error.
 
Any assistance, or even attempts of assistance will be super appreciated.
Thank you 🙂
Replies 3 (3)

SoshJam
Shopify Partner
7 2 1

Did you ever resolve this error?

SoshJam
Shopify Partner
7 2 1

I added some extra delay (5 seconds, so quite a lot) after making the GraphQL request, and it seems to be working now. Fix your system, Shopify, a promise should not be returned until the data is actually ready.

 

 

 

ShopifyDevSup
Shopify Staff
1451 238 497

Hi @Arkadi and @SoshJam 

 

When multiple images are being added to the product by the productAppendImages mutation, there must have been some delay with one or more of the asynchronous background operations involved. 

Generally speaking, limiting the number of images in your inputs or adding a delay like @SoshJam suggested would be best, but since that mutation is deprecated I'd recommend moving to the createProductMedia mutation to see if that gives you better results.

 

Hope that helps.

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog