-
-
Notifications
You must be signed in to change notification settings - Fork 5
Fix failing "sync" job: handle Sentry API 403 gracefully instead of crashing #276
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
Changes from all commits
9dcd39a
99f5f0c
1e5f7f0
cb622f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -91,7 +91,18 @@ def create_github_issue(sentry_issue: dict) -> None: | |||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| def main() -> int: | ||||||||||||||||||||||||||||||||
| issues = get_new_sentry_issues() | ||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||
| issues = get_new_sentry_issues() | ||||||||||||||||||||||||||||||||
| except requests.exceptions.HTTPError as exc: | ||||||||||||||||||||||||||||||||
| status = exc.response.status_code if exc.response is not None else None | ||||||||||||||||||||||||||||||||
| if status in (401, 403): | ||||||||||||||||||||||||||||||||
| print( | ||||||||||||||||||||||||||||||||
| f"::warning::Sentry API request failed with HTTP {status}. " | ||||||||||||||||||||||||||||||||
| "This usually means SENTRY_AUTH_TOKEN is missing the 'event:read' " | ||||||||||||||||||||||||||||||||
| "and/or 'project:read' scopes required to list issues." | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
| raise | ||||||||||||||||||||||||||||||||
|
Comment on lines
+98
to
+104
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (bug_risk): For HTTP 401 or 403 responses, Triggers: When the Sentry issues endpoint returns HTTP 401 or 403. Suggested fix: Return
Suggested change
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| print(f"Found {len(issues)} unresolved Sentry issue(s) in the last {STATS_PERIOD}.") | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| for issue in issues: | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.