You might have noticed that we use a limit of 100, quite a bit lower from the maximum of 250.
Strangely enough, I'm able to run the same query successfully from my local machine, but we get a 502 every single time from our app's server.
Looking forward to your findings, and hopefully resolution.
We're seeing the same thing as well only for 1 store which only started on August 20 (there was a partial Shopify outage on this date which does make me wonder if it's somewhat related).
We retry each API request multiple times for 5xx errors and we do get the "Bad Gateway" message once in a while for other stores as well but they almost always resolve after 1 retry (sometimes 2). But for this particular store, it just keeps happening multiple times in a row.
It works fine if we change the date filter to a narrower data range, though, so it seems like possibly a database performance issue where the query is taking a long time to process and the API times out before it returns the results.
One thing that stands our with this store is their orders typically have a lot of line items. Would having many line items in an order cause much heavier queries (perhaps due to table joins)?