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

fix: improve webhook resilience #3200

Merged
merged 4 commits into from
Apr 5, 2023
Merged

fix: improve webhook resilience #3200

merged 4 commits into from
Apr 5, 2023

Conversation

hperl
Copy link
Contributor

@hperl hperl commented Mar 30, 2023

Changes:

  • Decouple post-registration post-persistence context from request context
  • Upgrade ory/x to use retrying in Jsonnet VM
  • Add better logging for when webhooks fail

Related issue(s)

Checklist

  • I have read the contributing guidelines.
  • I have referenced an issue containing the design document if my change
    introduces a new feature.
  • I am following the
    contributing code guidelines.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security vulnerability, I
    confirm that I got the approval (please contact
    security@ory.sh) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature
    works.
  • I have added or changed the documentation.

Further Comments

@hperl hperl requested a review from alnr March 30, 2023 10:38
alnr
alnr previously approved these changes Mar 30, 2023
@hperl hperl force-pushed the hperl/improve-webhooks branch 3 times, most recently from 0127cff to eeb1898 Compare March 30, 2023 12:44
@hperl hperl changed the title fix: improve webhook logging fix: improve webhook resilience Mar 30, 2023
@codecov
Copy link

codecov bot commented Mar 30, 2023

Codecov Report

Merging #3200 (1ba8e9f) into master (1180c05) will decrease coverage by 0.06%.
The diff coverage is 42.85%.

❗ Current head 1ba8e9f differs from pull request most recent head c1ac6f3. Consider uploading reports for the commit c1ac6f3 to get more accurate results

@@            Coverage Diff             @@
##           master    #3200      +/-   ##
==========================================
- Coverage   77.95%   77.89%   -0.06%     
==========================================
  Files         320      320              
  Lines       20428    20451      +23     
==========================================
+ Hits        15924    15931       +7     
- Misses       3301     3317      +16     
  Partials     1203     1203              
Impacted Files Coverage Δ
selfservice/flow/registration/hook.go 74.28% <20.00%> (-8.26%) ⬇️
driver/registry_default.go 87.02% <100.00%> (+0.06%) ⬆️
selfservice/hook/web_hook.go 80.00% <100.00%> (+0.52%) ⬆️

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@hperl hperl self-assigned this Mar 31, 2023
@hperl hperl requested a review from alnr March 31, 2023 08:48
selfservice/hook/web_hook.go Outdated Show resolved Hide resolved
@hperl hperl requested a review from alnr March 31, 2023 12:44
selfservice/hook/web_hook.go Outdated Show resolved Hide resolved
Copy link
Member

@zepatrik zepatrik left a comment

Choose a reason for hiding this comment

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

Please correct me, but I don't see new retry logic added, only context timeout added.

selfservice/flow/registration/hook.go Show resolved Hide resolved
selfservice/hook/web_hook.go Show resolved Hide resolved
@zepatrik
Copy link
Member

I realized that we already had an update of ory/x in a different PR, so the retry logic there is already on master 👍
However, I do not agree that we want to decouple the request context from the webhook, at least not for blocking hooks. Non-blocking hooks already have their own context, so I think we should keep that as is and just pick the log improvements from this PR.

aeneasr
aeneasr previously approved these changes Apr 1, 2023
Copy link
Member

@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

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

Looks good :)

zepatrik
zepatrik previously approved these changes Apr 4, 2023
@hperl hperl dismissed stale reviews from zepatrik and aeneasr via 4ed2964 April 5, 2023 07:25
@hperl hperl enabled auto-merge (squash) April 5, 2023 07:26
@aeneasr aeneasr removed the request for review from alnr April 5, 2023 09:44
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