UNINSTALL Webhook fails every time

todrick
Shopify Partner
4 0 1

What is the secret of making this work?

 

const response = await Shopify.Webhooks.Registry.register({
shop,
accessToken,
path: "/webhooks",
topic: "APP_UNINSTALLED",
webhookHandler: async (topic, shop, body) =>
delete ACTIVE_SHOPIFY_SHOPS[shop],
});

if (!response.success) {
console.log(
`FAILS EVERY TIME: ${response.result}`
);
}
Reply 1 (1)

lizk
Shopify Staff
246 58 72

Hi there!

If you could provide a bit more context that can help us figure out what the issue is here.

First off just to confirm you are using a template node application generated by the Shopify CLI and what version of the CLI are you using (you can run shopify version in your terminal to figure this out).

If this is a fresh clone of the template, and you haven't modified the code then it should just be working out of the box, so we would need to take a deeper look into what exactly is going wrong here.

What is the result of the response.result you are printing out?

Have you verified that the shop and the access token are valid at this point in the code execution? 

Have you modified the code since cloning it? If so what have you modified?

I would also recommend if you are just starting out there is a recently released new Node App Template. You can clone this by updating your version of the CLI or reviewing the code directly.
https://github.com/Shopify/shopify-app-node

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