You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently I started getting this error, when webhooks jobs are called:
ArgumentError: wrong number of arguments (given 1, expected 0; required keywords: shop_domain, webhook)
Steps to Reproduce
Generate a webhook rails g shopify_app:add_webhook -t carts/update -a https://example.com/webhooks/carts_update
Wait for a webhook to come in
Webhook argument error 🎉
Expected behavior:
I expect the webhook job generated by the generator to work.
Actual behavior:
Webhook job is erroring:
ArgumentError: wrong number of arguments (given 1, expected 0; required keywords: shop_domain, webhook)
Reproduces how often:
The error happens whenever a webhook job is called
Browsers
N/A
Gem versions
18.0.3
Additional Information
It seems that the webhook job arguments shop_domain, webhook, are now combined in a hash which is them being passed to the webhook job from the webhooks controller
# app-name/app/controllers/shopify_app/webhooks_controller.rb
module ShopifyApp
class MissingWebhookJobError < StandardError; end
class WebhooksController < ActionController::Base
include ShopifyApp::WebhookVerification
def receive
params.permit!
job_args = { shop_domain: shop_domain, webhook: webhook_params.to_h } # 👈
webhook_job_klass.perform_later(job_args) # 👈
head(:ok)
end
...
end
Am I missing something? Or should the generated job change to this:
class CartsUpdateJob < ActiveJob::Base
def perform(job_args)
shop = Shop.find_by(job_args[:shop_domain])
...
end
end
Description
Recently I started getting this error, when webhooks jobs are called:
Steps to Reproduce
rails g shopify_app:add_webhook -t carts/update -a https://example.com/webhooks/carts_update
Expected behavior:
I expect the webhook job generated by the generator to work.
Actual behavior:
Webhook job is erroring:
Reproduces how often:
The error happens whenever a webhook job is called
Browsers
N/A
Gem versions
18.0.3
Additional Information
It seems that the webhook job arguments
shop_domain
,webhook
, are now combined in a hash which is them being passed to the webhook job from the webhooks controllerAm I missing something? Or should the generated job change to this:
Or maybe the controller change to this
Security
The text was updated successfully, but these errors were encountered: