Updating product with images not working as expected

Conner
Explorer
46 1 9

Hello,

I'm having trouble updating products with images for a specific subset of products. This same code works for over 99% of product updates sent up, but for some reason doesn't work for a small handful of products. Does anything stick out to anyone?

 

I should mention that I do not receive any errors with either of the example requests listed below.

Request

PUT /products/{product_id}.json

 

Relevant snippet of image & images objects:

"images":[
   {
      "id":null,
      "product_id":"4470684254262",
      "position":3,
      "created_at":null,
      "updated_at":null,
      "src":"https://ik.imagekit.io/saintbernard/LAURExSUNFLOWERxPrimary.jpg",
      "variant_ids":[
         "31764343062582",
         "31764343095350",
         "31764343128118",
         "31764343160886"
      ]
   },
   {
      "id":null,
      "product_id":"4470684254262",
      "position":1,
      "created_at":null,
      "updated_at":null,
      "src":"https://ik.imagekit.io/saintbernard/LAURExCERULEANxPrimary.jpg",
      "variant_ids":[
         "31764342931510",
         "31764342964278",
         "31764342997046",
         "31764343029814"
      ]
   }
],
"image":{
   "id":null,
   "product_id":"4470684254262",
   "position":1,
   "created_at":null,
   "updated_at":null,
   "src":"https://ik.imagekit.io/saintbernard/LAURExCERULEANxPrimary.jpg",
   "variant_ids":null
}

Response

Relevant snippet of image & images objects:

"images":[
   {
      "id":15098851360822,
      "product_id":4470684254262,
      "position":1,
      "created_at":"2020-03-04T08:16:10-06:00",
      "updated_at":"2020-03-04T08:16:10-06:00",
      "alt":null,
      "width":750,
      "height":1000,
      "src":"https://cdn.shopify.com/s/files/1/1038/6190/products/LAURExSUNFLOWERxPrimary.jpg?v=1583331370",
      "variant_ids":[
         31764343062582,
         31764343095350,
         31764343128118,
         31764343160886
      ],
      "admin_graphql_api_id":"gid://shopify/ProductImage/15098851360822"
   }
],
"image":{
   "id":15098851360822,
   "product_id":4470684254262,
   "position":1,
   "created_at":"2020-03-04T08:16:10-06:00",
   "updated_at":"2020-03-04T08:16:10-06:00",
   "alt":null,
   "width":750,
   "height":1000,
   "src":"https://cdn.shopify.com/s/files/1/1038/6190/products/LAURExSUNFLOWERxPrimary.jpg?v=1583331370",
   "variant_ids":[
      31764343062582,
      31764343095350,
      31764343128118,
      31764343160886
   ],
   "admin_graphql_api_id":"gid://shopify/ProductImage/15098851360822"
}

Note: In the response, only 1 image actually gets applied.

 

I've played around with modifying the formatting of the JSON payload, but no luck. For example, I tried the following but get the same response:

 

"images":[
   {
      "id":null,
      "product_id":"4470684254262",
      "position":2,
      "created_at":null,
      "updated_at":null,
      "src":"https://ik.imagekit.io/saintbernard/LAURExSUNFLOWERxPrimary.jpg",
      "variant_ids":[
         "31764343062582",
         "31764343095350",
         "31764343128118",
         "31764343160886"
      ]
   }
],
"image":{
   "id":null,
   "product_id":"4470684254262",
   "position":1,
   "created_at":null,
   "updated_at":null,
   "src":"https://ik.imagekit.io/saintbernard/LAURExCERULEANxPrimary.jpg",
   "variant_ids":[
      "31764342931510",
      "31764342964278",
      "31764342997046",
      "31764343029814"
   ]
}

 

0 Likes
_JB
Shopify Staff
Shopify Staff
750 86 163

Hey @Conner,

 

I noticed the image that was attached successfully is only 354kb in size, but the two that failed are over 5mb in size. I suspect the failing images are timing out before our system is able to download them. If you can try that call again and provide the X-Request-ID from the response headers, I can check our logs to confirm.

 

If the images are in fact timing out, the solution will be to either host the images somewhere else that allows Shopify to download them without a timeout, or decrease the image size before uploading. You shouldn't need to decrease the image size however, a 5mb image shouldn't be a problem to download, so if that's what we're seeing I would recommend hosting them somewhere else first.

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me 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

0 Likes
Conner
Explorer
46 1 9

Hey @_JB ,

 

Appreciate you looking into this. Here you go:

 

X-Request-ID: 5f51e7b2-6014-4596-a0c5-9319908fd9f3

 

Thanks!

0 Likes
Conner
Explorer
46 1 9

@_JB 

Just following up here-- any chance the logs brought anything to light on your end?

Thanks!

0 Likes
Conner
Explorer
46 1 9

@_JB 

Following up here again-- Any luck looking into this?

0 Likes
atspear
New Member
3 0 0

I've unofficially confirmed that there is some sort of limit on the image size.  For me, I'm seeing anything over about 4MB not working via the API.

0 Likes