A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hello, I am getting 502 bad gateway error when I update a product with many images, this is the X-Request-ID: c6e76ab2-dc2e-4391-ae61-15e956b78efb
Hello @zhengxinxin,
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;
PUT /admin/api/2023-01/products/{ID}.json
We will keep an eye out for any updates here - Cheers!
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
Hi,
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.
API documentation: https://shopify.dev/docs/api/admin-rest/2023-01/resources/product#put-products-product-id
request api: /admin/api/2023-01/products/7391940804799.json
response header:
Thanks.
Hi @zhengxinxin,
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,
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
Hello!
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.