Our team had a closer look, wanted to ask a few questions as well as share a few ideas below.
Have you done troubleshooting with another development or test app, including debugging manually with tools such as Postman or Insomnia?
Have you been able to consistently replicate this error?
If not, how often does this occur? If so, does the behavior persist across multiple products, images, and/or stores?
Have you tested updating a single image, or using the Product Image resource?
After working through the info above, if you are still see this behaviour we can take another look, but will require some additional examples;
We will keep an eye out for any updates here - Cheers!
I have tested this api many times, and some products have been updated successfully, while others have returned 502 Bad Gateway. If the request fails, it will always return failure. I guess it's because there are too many pictures associated with products. There is no problem updating a single image, but it is too slow. We hope to update all images at once through the update product api.
request api: /admin/api/2023-01/products/7391940804799.json
I checked the logs and there's no specific error message, but I notice that the connection time was well over a minute before returning a 502 response.
The more data uploaded in a single request, images, (products, variants, etc.) can increase the risk of timeouts on the platform, so I would recommend limiting the size of your requests, or trying to import images in batches with a bulk import operation.
Hope that helps,
We just started encountering this same error, also when sending more than 50 images. The exact count where it broke was 54: 53 images got accepted.
We are still using an older REST API version: 2021-04. It is quite disheartening to see this happens in newer versions too. Nobody else encountered this in the past 2 years? How unlikely.
The error response, 502 Bad Gateway, is completely and utterly useless. It should be actionable, but all it does is give us a default error web page in HTML, of all languages. At leat provide an error in JSON or XML, conforming to the Accept header in the HTTP request.