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(webhook/logging): log response code only if response is not none #3354

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

gagantrivedi
Copy link
Member

@gagantrivedi gagantrivedi commented Jan 31, 2024

Thanks for submitting a PR! Please check the boxes below:

  • I have run pre-commit to check linting
  • I have added information to docs/ if required so people know about the feature!
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

Handle call_integration_webhook returning None in case of failure
details: https://flagsmith.sentry.io/issues/4874822372/?project=5544478&query=is%3Aunresolved&referrer=issue-stream&statsPeriod=24h&stream_index=0

How did you test this code?

I have tested it manually but writing a test for this will involve unit testing a private method. Keen to get some input on this

Copy link

vercel bot commented Jan 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview Jan 31, 2024 8:31am
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview Jan 31, 2024 8:31am
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview Jan 31, 2024 8:31am

@github-actions github-actions bot added the api Issue related to the REST API label Jan 31, 2024
@gagantrivedi gagantrivedi requested review from a team and matthewelwell and removed request for a team January 31, 2024 08:33
@codecov-commenter
Copy link

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (61537ce) 95.96% compared to head (d0f8162) 18.00%.

Files Patch % Lines
api/integrations/webhook/webhook.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #3354       +/-   ##
===========================================
- Coverage   95.96%   18.00%   -77.96%     
===========================================
  Files        1071      990       -81     
  Lines       32743    28561     -4182     
===========================================
- Hits        31421     5143    -26278     
- Misses       1322    23418    +22096     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented Jan 31, 2024

Uffizzi Preview deployment-45452 was deleted.

@@ -22,9 +22,10 @@ def __init__(self, config: WebhookConfiguration):

def _identify_user(self, data: typing.Mapping) -> None:
response = call_integration_webhook(self.config, data)
Copy link
Contributor

Choose a reason for hiding this comment

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

Under what circumstances does call_integration_webhook return None ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah ok, interesting. This solution seems fine for now I guess, but perhaps my original solution was wrong, and we should just try/except the call_integration_webhook function 🤔

@gagantrivedi gagantrivedi added this pull request to the merge queue Jan 31, 2024
Merged via the queue into main with commit ea42a34 Jan 31, 2024
21 checks passed
@gagantrivedi gagantrivedi deleted the fix/webhook/identify-user branch January 31, 2024 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants