Fix webhook handler dispatch with shopify_api v16 - #2084
Open
wehamed wants to merge 1 commit into
Open
Conversation
Generated webhook jobs still used the pre-v16 handle(topic:, shop:, body:, webhook_id:, api_version:) signature. shopify_api v16 dispatches WebhookMetadata through handle(data:), so registered webhook handlers raise ArgumentError during delivery. Update generated jobs to the v16 WebhookHandler contract and add regression coverage through the real Registry dispatch path. Fixes Shopify#2045
Author
|
I have signed the CLA! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Update generated webhook jobs to implement the shopify_api v16
WebhookHandlerdispatch contract:Generated jobs previously used the pre-v16
handle(topic:, shop:, body:, webhook_id:, api_version:)signature.shopify_api v16 dispatches
WebhookMetadatathroughhandle(data:), soregistered webhook handlers raised
ArgumentErrorduring delivery.This also conforms the webhook fixtures used across the test suite and adds
regression coverage through the real
Registrydispatch path.Fixes #2045
Reviewer's guide to testing
bundle exec rake test.test/shopify_app/managers/webhooks_manager_test.rbregisters a job through
WebhooksManager.add_registrations, then dispatches areal HMAC-signed webhook via
ShopifyAPI::Webhooks::Registry.process, assertingthe job is enqueued with the mapped
topic/shop_domain/webhookarguments.add_webhook,add_app_uninstalled_job, andadd_privacy_jobsnow assert that generated jobs implement the v16
handle(data:)contract.Things to focus on
handle(data:)contract and thedata.topic/data.shop/data.bodymapping.Registrydispatch path rather than the mocked registration.CHANGELOG.mdanddocs/Upgrading.mdexamples updated to the v16 contract.Checklist
Before submitting the PR, please consider if any of the following are needed:
CHANGELOG.mdif the changes would impact usersREADME.md, if appropriate./docs, if necessary