You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.
Adding a webhook handler for a topic that does not exist via addHandler/addHandlers causes the registerAll function to error.
This is undesirable behavior, as the Mandatory GDPR webhook topics (customers/data_request, customers/redact, and shop/redact) are considered invalid topics; this means that if you attempt to add handlers for the GDPR webhooks, the registerAll function no longer works.
Now, this is complicated by the fact that you aren't SUPPOSED to add handlers for the GDPR topics...but you can, and doing so is actually entirely functional!
Given that this package lacks a built-in method to validate the mandatory GDPR webhooks (or any documentation on doing so), this is a pretty severe gap in usability for many developers.
Now, one thing you CAN do is addHandler the GDPR topics, and then manually call Shopify.Webhooks.register for each non-GDPR topic you subscribe to for a shop...but this is extremely unintuitive, and again -- undocumented behavior.
Expected behavior
Two points of expected/desired behavior:
There is a way to register the mandatory GDPR webhooks without manually validating them per the comments here: Mandantory GDPR webhooks #256
Attempting to add a handler for an invalid topic does not completely break functionality of registerAll.
Actual behavior
Calling addHandler for GDPR webhook topics (or any other invalid topic) renders registerAll unusable.
Two options for developers: either manually validate GDPR webhooks, or manually call register for each non-GDPR webhook.
Steps to reproduce the problem
Add a handler for an invalid webhook topic. (I.E. Mandatory GDPR webhooks)
Add a handler for any valid webhook topic.
Call Shopify.Webhooks.Registry.registerAll (Note that individually calling register on each non-GDPR topic DOES work)
Thank you for reporting this, you make a great point. I think the ideal way for this to go would be for us to allow the GDPR topics in addHandler, but skip over them in registerAll. That way, apps can use the lib's webhook features in a consistent way.
As you mentioned, a temporary workaround would be to use the process method by adding all the handlers but "manually" looping over them and calling register instead of registerAll. But we'll make sure registerAll deals with this scenario for you.
The reason why this fails is that the API itself doesn't support subscribing to those events (it needs to happen in the partners dashboard).
Issue summary
Adding a webhook handler for a topic that does not exist via addHandler/addHandlers causes the registerAll function to error.
This is undesirable behavior, as the Mandatory GDPR webhook topics (customers/data_request, customers/redact, and shop/redact) are considered invalid topics; this means that if you attempt to add handlers for the GDPR webhooks, the registerAll function no longer works.
Now, this is complicated by the fact that you aren't SUPPOSED to add handlers for the GDPR topics...but you can, and doing so is actually entirely functional!
Given that this package lacks a built-in method to validate the mandatory GDPR webhooks (or any documentation on doing so), this is a pretty severe gap in usability for many developers.
Now, one thing you CAN do is addHandler the GDPR topics, and then manually call Shopify.Webhooks.register for each non-GDPR topic you subscribe to for a shop...but this is extremely unintuitive, and again -- undocumented behavior.
Expected behavior
Two points of expected/desired behavior:
There is a way to register the mandatory GDPR webhooks without manually validating them per the comments here: Mandantory GDPR webhooks #256
Attempting to add a handler for an invalid topic does not completely break functionality of registerAll.
Actual behavior
Calling addHandler for GDPR webhook topics (or any other invalid topic) renders registerAll unusable.
Two options for developers: either manually validate GDPR webhooks, or manually call register for each non-GDPR webhook.
Steps to reproduce the problem
Reduced test case
followed by, as part of shop auth:
Checklist
The text was updated successfully, but these errors were encountered: