can not register GDPR webhooks
Issue summary
Write a short description of the issue here ↓
const response = await Shopify.Webhooks.Registry.register({
path : path,
topic: "customers/data_request",
accessToken,
shop,
});
error:
TypeError: Cannot read property 'webhookSubscriptions' of undefined
Expected behavior
What do you think should happen?
Actual behavior
What actually happens?
Tip: include an error message (in a <details></details> tag) if your issue is related to an error
Steps to reproduce the problem
Reduced test case
The best way to get your bug fixed is to provide a reduced test case.
Checklist
- [ ] I have described this issue in a way that is actionable (if possible)
@redochka, unfortunately registering GDPR webhooks is not supported in this way. GDPR endpoints are considered mandatory webhooks for all public Shopify apps to subscribe to and need be specified in your app's configuration.
You can follow this guide to register these endpoints through the App setup menu in your Partner Dashboard.
ok, however, can I still use the library to add the handler?
Shopify.Webhooks.Registry.addHandler("customers/data_request", {
webhookHandler: gdprHandler,
})
Will the library work fine when the gdpr webhook is received?
@redochka
Nope!
You'll need to set up independent routes for handling the GDPR webhook requests, as well as run the validation for them. The process for doing so isn't in the documentation, especially as the webhook documentation is out of date and the Webhook verification process doesn't include Node examples in the dev docs; I've gone over a minimal example in the comments of this issue, including accounting for a conflict with express.json() / bodyParser that it's very easy to run into.
The TypeError: Cannot read property 'webhookSubscriptions' of undefined seems to happen when an invalid topic is passed to the register method.
It would be great if this error could be handled properly so its clear what the issue is?
This issue is stale because it has been open for 90 days with no activity. It will be closed if no further action occurs in 14 days.
We are closing this issue because it has been inactive for a few months. This probably means that it is not reproducible or it has been fixed in a newer version. If it’s an enhancement and hasn’t been taken on since it was submitted, then it seems other issues have taken priority.
If you still encounter this issue with the latest stable version, please reopen using the issue template. You can also contribute directly by submitting a pull request– see the CONTRIBUTING.md file for guidelines
Thank you!