A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Hello,
While creating products via the REST API, after some requests, the API returns a 502 Bad Gateway error.
In the first instance, I thought it would be the request limit so I have implemented a way to send the products in batches of 50 and with a delay of 1 second between each request ...
Unfortunately, while creating the products, I still get the same error.
Is there anyone who has experienced this in the past or would be able to help?
Many thanks in advance,
Tiago
That one is super easy to fix. Shopify will throw a 502 anytime it is overloaded. So when your Exception Handler gets handed a 502, you can simply sleep for say 10 seconds, and then run a retry on your code. It will almost always work then. If you wanted to get fancy you could back off retries by some exponential, like Sidekiq does, like 20, 40, 80, 160 seconds ... till it works.
You can expect 502. It is not an unusual return code.