What's your biggest current challenge? Have your say in Community Polls along the right column.
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.

Webhook successfully registered but not received

Webhook successfully registered but not received

Ralph6
New Member
6 0 0

I've followed Shopify's tutorial on how to build a app with NodeJS, but at part 8 (https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react/listen-for-store-events-with-w...) I've got stuck. The webhooks are successfully registered but not received (post route does not get fired). 

 

In my server.js file, I register the app/uninstalled webhook inside the afterAuth function like this:

const registration = await registerWebhook({
            address: `${PROCESS.env.HOST}/webhooks/app/uninstalled`,
            topic: 'APP_UNINSTALLED',
            accessToken,
            shop,
            apiVersion: ApiVersion.October19
            });

          if (registration.success) {
             console.log('Successfully registered webhook!');
          } else {
             console.log('Failed to register webhook', registration.result);
          }

 

Then later in the file, I listen for that webhook here:

const appUninstallWebhook = receiveWebhook({secret: SHOPIFY_API_SECRET_KEY});

  router.post('/webhooks/app/uninstalled', webhook, (ctx) => {
    console.log('received webhook: ', ctx.state.webhook);
    ctx.res.statusCode = 200;
  });

 

I see the webhook being registered, however when I delete the app running locally on NGROKin my test Shopify store, I do not see that webhook being triggered.

I tested this post route in Postman and it gives a 200 response, so I'm wondering where I am wrong. 

My app id is: 4284883.

Thank you in advance, 

 

Kind Regards 

 

Reply 1 (1)

zhangdi994
Visitor
1 0 0

我也遇到了这个问题   请问解决了吗