-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON Parser Error raised with unexpected HTML response from Shopfiy #1107
Comments
This may be a duplicate of #1091 |
I experience the same issue as what @ClaytonPassmore is describing here. This |
agreed, this is a duplicate of #1091. This is on our radar for this next release. Thanks for your patience and for letting us know what you are seeing! |
Issue summary
Occasionally Shopify will 500 and respond with HTML instead of JSON. When this happens, the client attempts to parse the response as JSON which ultimately raises a
JSON::ParserError
.shopify_api
version: 12.4.0Below is an example response from Shopify during a request to update a metafield on a product:
Expected behavior
This should raise a
ShopifyAPI::Errors::HttpResponseError
since Shopify is responding with a 500 status code.Actual behavior
The client raises a
JSON::ParserError
(which is not something I feel confident rescuing in my application code).Steps to reproduce the problem
This is incredibly difficult to reproduce in a real environment because it happens so infrequently. That said, it's trivial to reproduce it with a test case.
In
test/clients/http_client_test.rb
, add the following:Test results:
The text was updated successfully, but these errors were encountered: