Shopify / Shopify/shopify-api-ruby
Bug with webhook registration for `customer.tags_added` and `customer.tags_removed` topics
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 1.1k
- Forks
- 484
- PR merge metrics
- No merged PRs in 30d
Description
ShopifyApp::WebhooksManager.add_registrations does not work for those topics.
The topic contain . which is not handled correctly by the ShopifyAPI::Webhooks::Registration. On line 31 '/' is replaced with '_', while '.' is not replaced.
In the ShopifyAPI::Webhooks::Registry service on line 163 both '/' and '.' are replaced.
Expected behavior
Find the webhooks registered on an installed store
Actual behavior
The webhooks are missing with a silent fail
Steps to reproduce the problem
- Add the topics to your required webhooks.
- Install a store
- Check added webhooks
Debug logs
When running the registration for those 2 topics one gets an error in the grapqhl call
"message" => "syntax error, unexpected invalid token (\".\") at [2, 55]",
This is the current graphql mutation, and as one can see the topic is CUSTOMER.TAGS_ADDED instead of CUSTOMER_TAGS_ADDED
"mutation webhookSubscription {\n eventBridgeWebhookSubscriptionCreate(topic: CUSTOMER.TAGS_ADDED, webhookSubscription: {arn: \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/3358559/frcpOctavian\"}) {\n userErrors {\n field\n message\n }\n webhookSubscription {\n id\n }\n }\n}\n"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing ShopifyAPI::Webhooks::Registration with the normalization already used in ShopifyAPI::Webhooks::Registry, focusing on how webhook topics are converted before the GraphQL mutation. Reproduce registration for customer.tags_added and customer.tags_removed; done means the mutation uses CUSTOMER_TAGS_ADDED and CUSTOMER_TAGS_REMOVED and the webhooks are found on the installed store.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, ruby
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100