Hello there,
I tried to register the mandatory GDPR webhooks, so I can answer with the status code 200.
I’m working on a React app by following this article: https://shopify.dev/apps/getting-started/create.
Right next to the predefined webhook APP_UNINSTALLED which is already implemented per default when generating the project via CLI and which works perfectly fine
const response = await Shopify.Webhooks.Registry.register({
shop,
accessToken,
path: "/webhooks",
topic: "APP_UNINSTALLED",
webhookHandler: async (topic, shop, body) =>
delete ACTIVE_SHOPIFY_SHOPS[shop],
});
I tried to do the same for the GDPR webhooks… which look like this in my code:
await Shopify.Webhooks.Registry.register({
shop,
accessToken,
path: "/webhooks",
topic: "SHOP_REDACT",
webhookHandler: async (topic, shop, body) => {
console.log('/webhooks/shop REDACT webhook triggered', topic, shop, body);
}
});
await Shopify.Webhooks.Registry.register({
shop,
accessToken,
path: "/webhooks",
topic: "CUSTOMER_DATA_REQUEST",
webhookHandler: async (topic, shop, body) => console.log('/webhooks/customers DATA_REQUEST webhook triggered', topic, shop, body)
});
await Shopify.Webhooks.Registry.register({
shop,
accessToken,
path: "/webhooks",
topic: "CUSTOMERS_REDACT",
webhookHandler: async (topic, shop, body) =>
console.log('/webhooks/customers REDACT webhook triggered', topic, shop, body)
});
But I get the following error:
InternalServerError: Cannot read property ‘webhookSubscriptions’ of undefined
What am I doing wrong here?
