A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hi
We have now been receiving 500 errors, whenever we post a batch of new orders, for the last month now. Apparently there aren't any issues with the API, so why do we keep getting 500's?
We are making requests to this endpoint:
/admin/orders.json
Usually, somewhere in the chain of 500 responses, are some 422 (rate-limit-error) responses, is there a possibility that the Shopify API is not responding correctly to rate limiting?
In the 422 response headers, I have the following call limit header:
"x-shopify-shop-api-call-limit":["6/40"]
Hi @MStrudwick
Thank you for providing the x-request-ids in the responses. I've taken a look through our logs for the 500 level responses, and found that the app being used to make the request may be missing the scope to create new customers. Could you please confirm that the app has the write_customers permission enabled?
Regarding the 422 responses - this doesn't indicate throttling/rate-limiting (that would be 429) but rather the request being unprocessable. This is sometimes the result of missing fields or incorrect structure in the query.
Are you still experiencing these errors? If you could provide the x-request-id of an example of a similar order that returned 200 I can try and see if there are any obvious differences that would be causing these requests not to be accepted.
Regards,
To learn more visit the Shopify Help Center or the Community Blog.
Hi @csam
Thank you for checking for us! I have looked at our customers access token to check what scopes they have enabled and you are right, they are missing the scope `write_customers`. However, they do have the scope `unauthenticated_write_customers` - what is the difference?
I forgot to mention, but the interesting thing is, if we reprocess the exact same order POST request after it fails, then it works. So I'm not sure how the order could be missing fields or have an incorrect structure as it shouldn't work after?
Hi @MStrudwick
That's true, I wouldn't expect it to fail and then work if the request is the same. I would recommend adding some logging to your outgoing requests in order to see if there's anything different in the body or headers between the original request and the retry.
The unauthenticated scopes provide a different layer of access and are meant for the storefront API - this allows customers to indirectly interact with store data, however if you are creating customers with orders via the admin API, you require the authenticated access. You can read more about this here: https://shopify.dev/api/usage/access-scopes#unauthenticated-access-scopes
Regards,
To learn more visit the Shopify Help Center or the Community Blog.
Hi @csam
I have now added the correct scope (`write_customers`), however, we just tried to upload a batch of new orders and received over 64 errors from the API. All of these errors were '500 Server Error' from the Shopify API, again if I resend the exact same request (with JSON) the orders upload successfully.
I have attached some of the request IDs, please could you help us find what is causing this? It can't be the write_customers scope anymore, it is enabled, and we would not be able to resend the same order if there was an error with the request body.
Hi @MStrudwick
Thanks for the update and additional examples. I'll keep taking a look through our logs to see if I can determine the issue causing the error response. Are any requests you're making succeeding? If you could send an x-request-id of one of the successful requests, it would be helpful to compare.
Thanks!
To learn more visit the Shopify Help Center or the Community Blog.