Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
Any ideas why I am receiving this response when trying to:
https://shopify.dev/docs/admin-api/rest/reference/metafield?api[version]=2020-04#index-2020-04
Response:
{
"statusCode": 520,
"body": "<html>\r\n<head><title>520 Origin Error</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>520 Origin Error</h1></center>\r\n<hr><center>cloudflare-nginx</center>\r\n</body>\r\n</html>\r\n<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n",
"headers": {
"date": "Tue, 26 May 2020 23:04:41 GMT",
"content-type": "text/html",
"content-length": "581",
"connection": "close",
"set-cookie": [
"__cfduid=df06f3ce69470d4575261e22d793e17d91590534217; expires=Thu, 25-Jun-20 23:03:37 GMT; path=/; domain=.myshopify.com; HttpOnly; SameSite=Lax"
],
"cache-control": "no-store, no-cache",
"cf-cache-status": "DYNAMIC",
"cf-request-id": "02f4d336c00000c99550b08200000001",
"expect-ct": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"",
"server": "cloudflare",
"cf-ray": "599b216ac926c995-SEA",
"alt-svc": "h3-27=\":443\"; ma=86400, h3-25=\":443\"; ma=86400, h3-24=\":443\"; ma=86400, h3-23=\":443\"; ma=86400"
},
Just received this response with the same call to GET a products' metafields:
{
"statusCode": 524,
"body": "<html>\r\n<head><title>524 Origin Time-out</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>524 Origin Time-out</h1></center>\r\n<hr><center>cloudflare-nginx</center>\r\n</body>\r\n</html>\r\n<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n",
"headers": {
"date": "Wed, 27 May 2020 20:20:49 GMT",
"content-type": "text/html",
"content-length": "587",
"connection": "close",
"set-cookie": [
"__cfduid=d614f1609b7bda53a732f9aba5f93e1e71590610749; expires=Fri, 26-Jun-20 20:19:09 GMT; path=/; domain=.myshopify.com; HttpOnly; SameSite=Lax"
],
"cache-control": "no-store, no-cache",
"cf-request-id": "02f96300360000f569a6ac7200000001",
"expect-ct": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"",
"server": "cloudflare",
"cf-ray": "59a26de05b60f569-SEA",
"alt-svc": "h3-27=\":443\"; ma=86400, h3-25=\":443\"; ma=86400, h3-24=\":443\"; ma=86400, h3-23=\":443\"; ma=86400"
},
Am I the only person to get these error messages?
Hey @DSL,
I'm not familiar with these http_status codes personally, but a quick Google search tells me they're used primarily by Cloudflare.
Can you share more details about how you're making this request? As well, if you can you provide the full response headers from the call I can use that to try and find more information in our logs.
JB | Solutions Engineer @ Shopify
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
I am also intermittently getting a 524 Origin Time out whenever I make a cURL request to post inventory or pricing to products via API.
Here is the Header/site info I get back:
HTTP/1.1 524 Origin Time-out
Date: Tue, 04 Aug 2020 19:09:53 GMT
Content-Type: text/html
Content-Length: 185
Connection: keep-alive
Set-Cookie: __cfduid=d4bf718eeee8d593d1b67c2abd5599a1d1596568093; expires=Thu, 03-Sep-20 19:08:13 GMT; path=/; domain=.myshopify.com; HttpOnly; SameSite=Lax
Cache-Control: no-store, no-cache
cf-request-id: 045c78da490000e99ef694f200000001
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 5bda90d6db53e99e-DFW
alt-svc: h3-27=":443"; ma=86400, h3-28=";443"; ma=86400, h3-29=";443"; ma=86400
<html>
<head><title>524 Origin Time-out</title></head>
<body bgcolor="white">
<center><h1>524 Origin Time-out</h1></center>
<hr><center>cloudflare-nginx</center>
</body>
</html>
This is an exaple of one of our "520" errors:
HTTP/1.1 520 Origin Error
Date: Tue, 04 Aug 2020 19:56:00 GMT
Content-Type: text/html
Content-Length: 179
Connection: keep-alive
Set-Cookie: __cfduid=da8a6b18adfc39ebb39b776eaef2a4f9d1596570902; expires=Thu, 03-Sep-20 19:55:02 GMT; path=/; domain=.myshopify.com; HttpOnly; SameSite=Lax
Cache-Control: no-store, no-cache
CF-Cache-Status: DYNAMIC
cf-request-id: 045ca3b8cb0000d2763e121200000001
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 5bdad56e1babd276-DFW
alt-svc: h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400
<html>
<head><title>520 Origin Error</title></head>
<body bgcolor="white">
<center><h1>520 Origin Error</h1></center>
<hr><center>cloudflare-nginx</center>
</body>
</html>
Hey @Peter_Rhodes,
Far as I can tell these requests aren't hitting Shopify at all. How big are the payloads? I'm not sure what would cause intermittent timeouts like that, but I haven't seen other reports with these error responses. Can you provide the IP of the client making these calls?
JB | Solutions Engineer @ Shopify
- 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 JB,
Payloads are small.
IP is
I use the Inventory Levels API to send calls like this:
POST /admin/inventory_levels/set.json
{
"location_id": 905684977,
"inventory_item_id": 808950810,
"available": 42
}
I am running updates for a few hundred/thousand Products/Product Variants
every hour (depends on amounts and types of changes, whether new additions, change in price, or inventory updates)
Updates are mostly successful, but I did get feedback from support that I
am trying to update invalid inventory_ids, and that my JSON data may be
malformed in certain cases:
"I recommend reviewing your endpoints and the contents of the body before making the calls. They are not matching up with the information on your store and are not being formatted correctly. I recommend reviewing our Inventory API guides to make sure you are following the examples as expected."
My primary goal was to attempt to avoid the *5xx *errors, but I now wonder
if Shopify is throwing me off due to a higher than expected number of *4xx *
errors.
Thanks for following up.
Hey @Peter_Rhodes,
5XX errors won't be related to any previous requests that received a 4XX response. When your app receives a 5XX response, is it automatically retrying the request again? If so, does the request usually succeed on the next attempt?
I did notice your calls don't include an API version. While this also shouldn't be the cause for 5XX errors, it's one more variable that could perhaps be contributing to unexpected behaviours. We recommend including the API version for all calls, so if possible I would try adding this to see if it makes any difference. Please let me know if you implement this, and what the results are. In the meantime, I'll try running a script against my test store to see if I can replicate the bad gateway errors. I'll let you know if I'm able to replicate errors with that.
JB | Solutions Engineer @ Shopify
- 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 JB,
5XX errors won't be related to any previous requests that received a 4XX response. When your app receives a 5XX response, is it automatically retrying the request again? If so, does the request usually succeed on the next attempt?
No. I mark items that fail to update and run them later, typically with success. Only rarely are there additional 5xx errors when I do another pass, but when I am running 5 or six "threads" at times, I will have multiple records (about 1 in 10 variants) hit the 5xx wall for about 10-30 seconds before it goes back to normal.
I did notice your calls don't include an API version. While this also shouldn't be the cause for 5XX errors, it's one more variable that could perhaps be contributing to unexpected behaviours. We recommend including the API version for all calls, so if possible I would try adding this to see if it makes any difference. Please let me know if you implement this, and what the results are. In the meantime, I'll try running a script against my test store to see if I can replicate the bad gateway errors. I'll let you know if I'm able to replicate errors with that.
I am working on updating the codebase to include the API version, and I will report back on what I find. Thank you.
Did you found a solution for this? I'm in the same issue
thanks in advance.
No official resolution, yet, that I have heard. I had to update my API calls with the appropriate date info, and provide better filtering for bad product info, but I still occasionally have the 520 error pop up.
Hi All,
Throwing my hat into the ring as well on this one. I've been getting on average, 2 of these 520 Origin errors per day (sometimes it's 520 Unknown Status which is a weird one). There's no pattern at the moment in terms of endpoint other than the fact that I only get it from the GraphQL API.
I'm about to add a retry for this as I didn't have it in my retry list previously.
Kris
After never having seen this before, I got two of these today while fetching metafields for a product.
@Peter_Rhodes I never came back and gave a report. After making adjustments to my code and using the http number codes to provide better feedback on my end, I can confidently say that the 520 origin error is best described here: https://community.cloudflare.com/t/cloudflare-520-error/571670/4
All 5xx errors are issues with the responding server (in this case Shopify and Cloudflare) handling requests.
That's it.
All we can do is set up a Retry loop on our processes, report failures, and notify Shopify support if it's happening more than 1/10 times. On my bad days, typically, I only see 5% issues with the 5xx errors, and they resolve quickly.
I hope this helps!