Response for product create api sometimes doesn't contain all images

dimamj
Shopify Partner
9 1 0

Hi. We use our api to create shopify products with images - https://shopify.dev/docs/admin-api/rest/reference/products/product#create-2021-04 and we noticed that sometimes, when we set images with src in request body, we don't recieve all of them in response from shopify.

I.e. we create product with 5 images and we get only 4 created images in response. Why it may happen ?

Thanks.

Replies 8 (8)

_JB
Shopify Staff
836 100 222

Hey @dimamj,

Can you clarify if the images are only missing from the response, or do they also fail to get attached to the product?

The most common reason for image uploads to fail is when our system is unable to download the images in a timely manner. If you provide a product_id and rough timeframe from when you made the call, we can look further in the logs.

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

dimamj
Shopify Partner
9 1 0

Hi! Thanks for the reply.

To be honest I don't know if they can fail to get attached to the product or not, because our markets get this problem and we can't reproduce it by yourself.

product_id

6549137162263

Apr 23, 2021 6:32:45 AM UTC 

_JB
Shopify Staff
836 100 222

Hey @dimamj,

For that product it looks like the API call included 2 images, and both were attached successfully. Do you know what was included in the response for this call? If you haven't already, I suggest adding some kind of validation that compares the number of images in the request and response, and logs any differences. But from what I can see this call worked as expected.

Side note, it looks like your app isn't including an API version in the endpoint URL. It's highly recommended to include the version so you can avoid any breaking behaviours when features are deprecated. 

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

dimamj
Shopify Partner
9 1 0

Hi @_JB I added more logs. We caught it again (May 11, 2021 11:18:55 AM UTC)


So I see that we try to create a product that has 1 image (id=null, attachment = image in base64, position = 1, src=null)

And in response I see that images are empty array (product id 6773344698527)

Also I see that user creates >30 products one by one at that moment. (maybe it will be usefull for you)

 

Thanks.

_JB
Shopify Staff
836 100 222

Hey @dimamj,

I'm seeing this error in our logs Failed to generate extension because: Could not determine content type of provided image. Could not generate an image extension name. Can you confirm if the same call works if you retry or send it manually with an http client like Postman or Insomnia?

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

dimamj
Shopify Partner
9 1 0

Hi @_JB I confirm it, when user retried to create the product again, it was created and there is one image.

Product id - 6773346271391

dimamj
Shopify Partner
9 1 0

Hi @_JB , do you have any news about this ?

dimamj
Shopify Partner
9 1 0

Hi @_JB . One more case - Jun 18, 2021 2:37:02 AM UTC, product id - 6560408141847, 2 images