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

Added helpful error responses to webhook test notifications #5822

Merged

Conversation

JL102
Copy link
Contributor

@JL102 JL102 commented Mar 20, 2024

When a webhook test notification fails, the alert div below the button will now give more specific errors.

Description

I modified apidocs_webhooks.html to display all errors in the alert div below the button instead of using alert() for some, and I modified apidocs.py to send JSON responses for specific errors, e.g. invalid or not specified match keys.

Motivation and Context

Unfortunately this still doesn't help with the CSRF Expired error that occurs on the TBA prod site, since the error object from a failed authentication call returns HTML, and it'd be unsafe to set the HTML inside the alert div from a web response. However, this will help in the case where there's an error inside apidocs.py apidocs_webhooks_notification function.

How Has This Been Tested?

Tested by putting valid and invalid match / event keys into the webhook testing page.

Screenshots (if appropriate):

Example error message: (on my local database, I don't have events from 2014, so it shows a 'not found')
image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change API specifications or require data migrations)

Copy link
Member

@fangeugene fangeugene left a comment

Choose a reason for hiding this comment

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

Sorry this got overlooked earlier this season. This is amazing thanks so much

fangeugene
fangeugene previously approved these changes May 25, 2024
@fangeugene fangeugene enabled auto-merge (squash) May 25, 2024 03:20
Copy link

codecov bot commented May 25, 2024

Codecov Report

Attention: Patch coverage is 72.72727% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 92.88%. Comparing base (24652da) to head (2418329).
Report is 189 commits behind head on py3.

Files Patch % Lines
src/backend/web/handlers/apidocs.py 72.72% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              py3    #5822      +/-   ##
==========================================
- Coverage   93.10%   92.88%   -0.23%     
==========================================
  Files         658      656       -2     
  Lines       42145    42580     +435     
  Branches       60       60              
==========================================
+ Hits        39241    39551     +310     
- Misses       2896     3021     +125     
  Partials        8        8              

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

@fangeugene fangeugene merged commit 165ad0b into the-blue-alliance:py3 May 25, 2024
15 checks passed
github-actions bot added a commit that referenced this pull request May 25, 2024
Copy link

Screenshots

Homepage

Homepage

GameDay

GameDay

github-actions bot added a commit that referenced this pull request May 25, 2024
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

2 participants