-
Notifications
You must be signed in to change notification settings - Fork 476
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
TypeError in ShopifyApp::WebhooksManagerJob when ShopifyAPI::Context.response_as_struct is set to true #1311
Comments
Thanks for flagging this, and digging into the root cause! If you want to put up a PR to resolve this the team would definitely review to get this out quickly. Otherwise we will look into fixing this in the near future. |
@lizkenyon Have a Commit ready, but no permissions to push a branch it seems. |
@DaveEshopGuide You will need to create a fork of the repo, and then create a PR. Thanks so much! |
…h, even if ShopifyAPI.Context.response_as_struct is true. Had to add a Utility (ShopifyAPI::Utils::OstructHashUtils) to handle the conversion since a simple .to_h and even JSON.parse(response.body.to_json) did not work as expected (nested Keys and Array handling failed).
@lizkenyon PR created. |
…y is always a Hash, even if ShopifyAPI.Context.response_as_struct is true. Had to add a Utility (ShopifyAPI::Utils::OstructHashUtils) to handle the conversion since a simple .to_h and even JSON.parse(response.body.to_json) did not work as expected (nested Keys and Array handling failed).
…y is always a Hash, even if ShopifyAPI.Context.response_as_struct is true. Had to add a Utility (ShopifyAPI::Utils::OstructHashUtils) to handle the conversion since a simple .to_h and even JSON.parse(response.body.to_json) did not work as expected (nested Keys and Array handling failed).
…y is always a Hash, even if ShopifyAPI.Context.response_as_struct is true. Had to add a Utility (ShopifyAPI::Utils::OstructHashUtils) to handle the conversion since a simple .to_h and even JSON.parse(response.body.to_json) did not work as expected (nested Keys and Array handling failed).
…y is always a Hash, even if ShopifyAPI.Context.response_as_struct is true. Had to add a Utility (ShopifyAPI::Utils::OstructHashUtils) to handle the conversion since a simple .to_h and even JSON.parse(response.body.to_json) did not work as expected (nested Keys and Array handling failed).
Issue summary
Hello,
I am encountering an issue with the
ShopifyApp::WebhooksManagerJob
whenresponse_as_struct
is set to true in theShopifyAPI::Context.setup
configuration.Expected behavior
Webhooks registry should adapt to the response_as_struct setting and not throw an error.
Actual behavior
Webhooks registry throws an error on running the WebhooksManager
Steps to reproduce the problem
Debug logs
class=ShopifyApp::WebhooksManagerJob jid=5f9296991f0ea1d916d3c55c ERROR: Error performing ShopifyApp::WebhooksManagerJob (Job ID: d541fd80-49ba-48aa-9cf7-adc575680edd) from Sidekiq(default) in 544.34ms: TypeError (T.cast: Expected type T::Hash[String, T.untyped], got type OpenStruct
This line
parsed_check_result = registration.parse_check_result(T.cast(check_response.body, T::Hash[String, T.untyped]))
should only expect T::Hash[String, T.untyped] if response_as_struct is false.
Also referenced here: Shopify/shopify_app#1830
The text was updated successfully, but these errors were encountered: