我一直试图使用官方shopify_app gem为我的Shopify应用程序添加webhook。如何在shopify_app gem中使用webhooks?
所以我运行rails g shopify_app:add_webhook -t products/update -a https://example.com/webhooks/products_update
,看到每个文件都按照预期生成,并且在测试存储中安装我的应用程序后检查日志也显示webhook已成功启动。
然而,后在店实际上是在更新产品,我得到一个错误说:
ShopifyApp::MissingWebhookJobError (ShopifyApp::MissingWebhookJobError):
shopify_app (7.2.9) app/controllers/shopify_app/webhooks_controller.rb:21:in `webhook_job_klass'
shopify_app (7.2.9) app/controllers/shopify_app/webhooks_controller.rb:10:in `receive'
actionpack (5.0.3) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
...持续了大约40条线越来越但是大约10-30秒后重演,在投掷之前向我展示参数。我并没有改变products_job.rb
,所以它仍然看起来像这样:(虽然我试着去改变它很多次)
class ProductsJob < ActiveJob::Base
def perform(shop_domain:, webhook:)
shop = Shop.find_by(shopify_domain: shop_domain)
shop.with_shopify_session do
end
end
end
我会非常高兴得到这个任意输入,因为我新来Shopify应用程序和到Rails太(你可能会说^^)
谢谢,乔治
我已经尝试重新启动服务器并重新安装Shopify商店中的应用程序多次,不幸的是,这并没有帮助..你是什么意思与“检查你的相应webhook是否可用在那里或没有在安装页面”?在点击安装之前,我只能看到我的应用程序请求了哪些权限,没有任何关于任何webhook的信息...... – Georg