Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

ShopifyApp::MissingWebhookJobError (NameError) after update shopify_app to 19.0.1

Solved

ShopifyApp::MissingWebhookJobError (NameError) after update shopify_app to 19.0.1

rickmaxg3
Shopify Partner
6 3 0

I got this error after to update shopify_app gem to 19.0.1:

 

`webhook_job_klass': uninitialized constant ShopifyApp::MissingWebhookJobError (NameError)

 

Folowing steps to upgrade, i have to add a new handle method to existing webhook jobs to go through the updated shopify_api gem.

 

class MyWebhookJob < ActiveJob::Base
  extend ShopifyAPI::Webhooks::Handler

  class << self
    # new handle function
    def handle(topic:, shop:, body:)
      # delegate to pre-existing perform_later function
      perform_later(topic: topic, shop_domain: shop, webhook: body)
    end
  end

  # original perform function
  def perform(topic:, shop_domain:, webhook:)
    # ...

 

 

After some debugging it looks like these errors belong in the 'orders/updated' topic webhook.
Any way to fix?

 

Accepted Solution (1)

rickmaxg3
Shopify Partner
6 3 0

This is an accepted solution.

When registering a webhook the shopify_app gem now conveniently lets it know when a corresponding job with the same name cannot be found. Which is what is causing the issue here.


In my case i had multiples webhooks pointed to the same "orders_update" job.

config.webhooks = [
    { topic: 'orders/create', address: "#{ENV['HOST_URL']}/webhooks/orders_create", format: 'json' },
    { topic: 'orders/updated', address: "#{ENV['HOST_URL']}/webhooks/orders_updated", format: 'json' },
    { topic: 'orders/cancelled', address: "#{ENV['HOST_URL']}/webhooks/orders_updated", format: 'json' },
    { topic: 'orders/paid', address: "#{ENV['HOST_URL']}/webhooks/orders_updated", format: 'json' },
    { topic: 'orders/fulfilled', address: "#{ENV['HOST_URL']}/webhooks/orders_updated", format: 'json' },
    { topic: 'orders/partially_fulfilled', address: "#{ENV['HOST_URL']}/webhooks/orders_updated", format: 'json' },
    { topic: 'orders/delete', address: "#{ENV['HOST_URL']}/webhooks/orders_delete", format: 'json' },
    { topic: 'app/uninstalled', address: "#{ENV['HOST_URL']}/webhooks/app_uninstalled", format: 'json' },
    { topic: 'shop/update', address: "#{ENV['HOST_URL']}/webhooks/shop_update", format: 'json' }
  ]

In this new version 19.0.1 it was necessary to create a job for each webhook even though they do the same job.
In the old versions this was not a problem.
To fix this you need to create a job for each webhook.

View solution in original post

Reply 1 (1)

rickmaxg3
Shopify Partner
6 3 0

This is an accepted solution.

When registering a webhook the shopify_app gem now conveniently lets it know when a corresponding job with the same name cannot be found. Which is what is causing the issue here.


In my case i had multiples webhooks pointed to the same "orders_update" job.

config.webhooks = [
    { topic: 'orders/create', address: "#{ENV['HOST_URL']}/webhooks/orders_create", format: 'json' },
    { topic: 'orders/updated', address: "#{ENV['HOST_URL']}/webhooks/orders_updated", format: 'json' },
    { topic: 'orders/cancelled', address: "#{ENV['HOST_URL']}/webhooks/orders_updated", format: 'json' },
    { topic: 'orders/paid', address: "#{ENV['HOST_URL']}/webhooks/orders_updated", format: 'json' },
    { topic: 'orders/fulfilled', address: "#{ENV['HOST_URL']}/webhooks/orders_updated", format: 'json' },
    { topic: 'orders/partially_fulfilled', address: "#{ENV['HOST_URL']}/webhooks/orders_updated", format: 'json' },
    { topic: 'orders/delete', address: "#{ENV['HOST_URL']}/webhooks/orders_delete", format: 'json' },
    { topic: 'app/uninstalled', address: "#{ENV['HOST_URL']}/webhooks/app_uninstalled", format: 'json' },
    { topic: 'shop/update', address: "#{ENV['HOST_URL']}/webhooks/shop_update", format: 'json' }
  ]

In this new version 19.0.1 it was necessary to create a job for each webhook even though they do the same job.
In the old versions this was not a problem.
To fix this you need to create a job for each webhook.