Webhook event not received by ActiveJob in Rails Developement Environement

Highlighted
Shopify Partner
2 0 0

Hello, first all of forgive my noobiness as I'm just learning coding...

 

I created a shopify app with the shopify_app gem 8.4.0 and generated a 'products/update' webhook. 

 

Per shopify recommendation (https://help.shopify.com/en/api/getting-started/webhooks) and for test purposes I use beeceptor service to set my webhook end point with the following generator:

 

rails g shopify_app:add_webhook -t products/update -a https://myendpoint.free.beeceptor.com/webhooks/products_update

Resulting with the following line in my initializer/shopify_app.rb:

 

#config/intializers/shopify_app.rb 

  config.webhooks = [
    {topic: 'products/update', address: 'https://myendpoint.free.beeceptor.com/webhooks/product_update', format: 'json'},
  ]

The webhook is properly installed and when I update a product title I can see the POST request body with the modified product hash in the beeceptor console with a 200 response.

 

 

My active job has been created by the generator:

 

 

#app/jobs/prouct_update_job.rb
class ProductUpdateJob < ActiveJob::Base def perform(shop_domain:, webhook:) shop = Shop.find_by(shopify_domain: shop_domain) shop.with_shopify_session do p "New product update received" end end end

Here I just wanted to see a message in the console to confirm that the app was seeing the webhook event.

 

While I can see the job active in the console, I never get any message when I update a product.

I'm using codeanywhere.com and I'm running the server in the developement enviroment, listening to tcp://0.0.0.0:3000

 

To summarize:

1) I'm able to create the webhook with a demo store

2) The webhook fires as soon as I update a product and the request body is visible in beeceptor console

3) The activejob doesn't seem to get the event.

I have a feeling this is link to my development environment not allowing to listen to the beecepto endpoint.

Can anyone help me with my situation?

 

PS: I also tried to setup the webhook endpoint via ngrok and everytime I update a product I get a 502 error in the ngrok console.

Attached the server log

 

Please HELP...

Thank you!

 

 

 

 

 

 

0 Likes