Failed to process webhook: Error: No webhook is registered for topic orders/create

Arjun98
Shopify Partner
13 0 1

Hi team

 

We are currently developing a shopify and and i need to add a ORDER_CREATE webhook to track the orders in the store and so i just added the code to register the webhook.

 

const orderresponses = await Shopify.Webhooks.Registry.register({
          shop,
          accessToken,
          path: "/webhooks",
          topic: "ORDERS_CREATE",
          apiVersion: Shopify.Context.API_VERSION,
          webhookHandler: async (topic, shop, body) => { 
            const obj = JSON.parse(body);
            console.log("product creates");
            console.log(obj) },
        });

if (!orderresponses["ORDERS_CREATE"].success) {
          console.log(
            `Failed to register ORDERS_CREATE webhook: ${orderresponses.result}`
          );
        }

 

 

but after register the webhook when i place an order it shows like the " Failed to process webhook: Error: No webhook is registered for topic orders/create " 

 

but when i log the registered webhooks it shows like the create order webhook is already registered

 

webhook.PNG

 

so the issue occur in the stage of processing the webhook and it is not working when we access the webhook

 

am i wrong in something can any one share any suggestion it will be very helpful.

@LetterT  @PaulBouisset  @goldenphoenix 

 

Replies 2 (2)

cdarne
Shopify Staff
30 5 14

Hey Arjun98,

 

Thanks for your question. I'm not a node lib specialist, but maybe you should register a webhook handler (Shopify.Webhooks.Registry.addHandler) before registering the webhook (Shopify.Webhooks.Registry.register). Here's a full example here:  https://github.com/Shopify/shopify-node-api/blob/main/docs/usage/webhooks.md#load-your-handlers 

 

I hope this helps you,

 

Cheers!

 

Cédric | Developer @ Shopify

To learn more visit the Shopify Help Center or the Community Blog.

CrispyNoodle
Shopify Partner
2 0 3

This solution works for me. I was just upgrading the shopify-api package from 1.x and 2.x and the same problem occurred. Turned out that the Shopify.Webhooks.Registry.register no longer accepts the webhookHandler as one of the parameters (according to the document) and you have to add the handler separately before register the webhook.