Skip to content

Commit 56fc3b4

Browse files
committed
Fix TypeError in webhook job templates with shopify_api >= 16.0.0
Unblock users experiencing TypeError when registering webhook handlers due to Sorbet type checking introduced in shopify_api-16.0.0 Changed to for ShopifyAPI::Webhooks::WebhookHandler in all webhook job templates. This makes the class object itself satisfy the WebhookHandler type expected by WebhooksManager.add_registrations Affected templates: - app_uninstalled_job.rb.tt - customers_data_request_job.rb.tt - customers_redact_job.rb.tt - shop_redact_job.rb.tt - webhook_job.rb.tt
1 parent e7ae8e5 commit 56fc3b4

File tree

6 files changed

+16
-25
lines changed

6 files changed

+16
-25
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Unreleased
22
----------
3+
- [Patch] Fix sorbet errors in generated webhook handlers
34

45
23.0.1 (December 22, 2025)
56
- Fix engine initialization [#2040](https://github.com/Shopify/shopify_app/pull/2040)

lib/generators/shopify_app/add_app_uninstalled_job/templates/app_uninstalled_job.rb.tt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
class AppUninstalledJob < ActiveJob::Base
2-
include ShopifyAPI::Webhooks::WebhookHandler
2+
extend ShopifyAPI::Webhooks::WebhookHandler
33

4-
class << self
5-
def handle(topic:, shop:, body:, webhook_id:, api_version:)
6-
perform_later(topic: topic, shop_domain: shop, webhook: body)
7-
end
4+
def self.handle(topic:, shop:, body:, webhook_id:, api_version:)
5+
perform_later(topic: topic, shop_domain: shop, webhook: body)
86
end
97

108
def perform(topic:, shop_domain:, webhook:)

lib/generators/shopify_app/add_privacy_jobs/templates/customers_data_request_job.rb.tt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
class CustomersDataRequestJob < ActiveJob::Base
2-
include ShopifyAPI::Webhooks::WebhookHandler
2+
extend ShopifyAPI::Webhooks::WebhookHandler
33

4-
class << self
5-
def handle(topic:, shop:, body:, webhook_id:, api_version:)
6-
perform_later(topic: topic, shop_domain: shop, webhook: body)
7-
end
4+
def self.handle(topic:, shop:, body:, webhook_id:, api_version:)
5+
perform_later(topic: topic, shop_domain: shop, webhook: body)
86
end
97

108
def perform(topic:, shop_domain:, webhook:)

lib/generators/shopify_app/add_privacy_jobs/templates/customers_redact_job.rb.tt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
class CustomersRedactJob < ActiveJob::Base
2-
include ShopifyAPI::Webhooks::WebhookHandler
2+
extend ShopifyAPI::Webhooks::WebhookHandler
33

4-
class << self
5-
def handle(topic:, shop:, body:, webhook_id:, api_version:)
6-
perform_later(topic: topic, shop_domain: shop, webhook: body)
7-
end
4+
def self.handle(topic:, shop:, body:, webhook_id:, api_version:)
5+
perform_later(topic: topic, shop_domain: shop, webhook: body)
86
end
97

108
def perform(topic:, shop_domain:, webhook:)

lib/generators/shopify_app/add_privacy_jobs/templates/shop_redact_job.rb.tt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
class ShopRedactJob < ActiveJob::Base
2-
include ShopifyAPI::Webhooks::WebhookHandler
2+
extend ShopifyAPI::Webhooks::WebhookHandler
33

4-
class << self
5-
def handle(topic:, shop:, body:, webhook_id:, api_version:)
6-
perform_later(topic: topic, shop_domain: shop, webhook: body)
7-
end
4+
def self.handle(topic:, shop:, body:, webhook_id:, api_version:)
5+
perform_later(topic: topic, shop_domain: shop, webhook: body)
86
end
97

108
def perform(topic:, shop_domain:, webhook:)

lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
class <%= @job_class_name %> < ActiveJob::Base
2-
include ShopifyAPI::Webhooks::WebhookHandler
2+
extend ShopifyAPI::Webhooks::WebhookHandler
33

4-
class << self
5-
def handle(topic:, shop:, body:, webhook_id:, api_version:)
6-
perform_later(topic: topic, shop_domain: shop, webhook: body)
7-
end
4+
def self.handle(topic:, shop:, body:, webhook_id:, api_version:)
5+
perform_later(topic: topic, shop_domain: shop, webhook: body)
86
end
97

108
def perform(topic:, shop_domain:, webhook:)

0 commit comments

Comments
 (0)