skip to Main Content

for the last hours I’ve been trying to add a webhook to my Shopify app using the official shopify_app gem.

So I ran rails g shopify_app:add_webhook -t products/update -a https://example.com/webhooks/products_update and saw every file getting generated as expected and checking the logs after installing my app in a Test Store also showed me that the webhook was initiated successfully.

However, after actually updating a product in the shop, I get an error saying:

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'

…going on for about 40 lines more and repeating itself after about 10-30 seconds, however, showing me the params before throwing it. I haven’t changed the products_job.rb, so it’s still looking like this: (although I’ve tried to change it many times)

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

I’d be really happy to get any input on this, as I’m new to Shopify Apps and to Rails too (as you can probably tell ^^)

Thanks, Georg

2

Answers


  1. Have you restarted your rails server after installing the webhook.
    Do restart your rails server also uninstall and reinstall your app in the shopify store and before clicking install button check your corresponding webhook is available there or not in the installation page.

    Login or Signup to reply.
  2. Your products update job file name should be like products_update_job.rb not products_job.rb also the contents should be as below:

    class ProductsUpdateJob < ActiveJob::Base
      def perform(shop_domain:, webhook:)
        shop = Shop.find_by(shopify_domain: shop_domain)
    
        shop.with_shopify_session do
        end
      end
    end
    

    Try this changes you will get it.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search