Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip mandatory webhook topics during registration/unregistration #1237

Merged
merged 4 commits into from
Oct 31, 2023

Conversation

nelsonwittwer
Copy link
Contributor

@nelsonwittwer nelsonwittwer commented Oct 31, 2023

Description

Friction with mandatory webhooks was identified in the shopify app gem. Since Mandatory webhooks aren't subscribed to via API, we need to gracefully skip them during registrations without breaking handlers.

This skips registration/unregistration for mandatory topics that are managed in the partner dashboard

How has this been tested?

Unit tests within this library. I've also created a new app using our ruby app template pointing to this branch and my fix to the app gem's branch to verify I could recreate webhook without error.

Checklist:

  • My commit message follow the pattern described in here
  • I have performed a self-review of my own code.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have updated the project documentation.
  • I have added a changelog line.

@nelsonwittwer nelsonwittwer requested a review from a team as a code owner October 31, 2023 13:53
Copy link
Contributor

@paulomarg paulomarg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

@nelsonwittwer nelsonwittwer merged commit 82e4caf into main Oct 31, 2023
7 checks passed
@nelsonwittwer nelsonwittwer deleted the nw/mandatory_webhook branch October 31, 2023 14:15
@mironov
Copy link

mironov commented Nov 14, 2023

I think this breaks webhooks processing for mandatory webhooks.

handler = @registry[request.topic]&.handler
unless handler
raise Errors::NoWebhookHandler, "No webhook handler found for topic: #{request.topic}."
end

The @registry[request.topic] will be nil for mandatory webhooks because they were skipped in

return if mandatory_webhook_topic?(topic)
@registry[topic] = case delivery_method

@kirillplatonov
Copy link

Yep, I can confirm that too. Mandatory webhooks in v13.3.0 are broken. Please rollback this PR.

@nelsonwittwer
Copy link
Contributor Author

Fixed with #1249

@kirillplatonov
Copy link

Thanks for the quick fix! 🙏

garethson pushed a commit to garethson/shopify-api-ruby that referenced this pull request Dec 1, 2023
…pify#1237)

* Do not allow registration to mandatory webhooks

* skip unregister calls for mandatory webhooks

* changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants