-
Notifications
You must be signed in to change notification settings - Fork 16
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
Bug/1707 ez vapid #299
Bug/1707 ez vapid #299
Conversation
Previously, we would accept invalidly formatted VAPID values (e.g. a string numeric value for `exp`.) With rust, we can no longer do that. Return an error that's more descriptive of what the problem is so that folk can fix it. Closes #1707
Closes: #CONSRV-1708
@@ -22,22 +23,46 @@ pub fn sentry_middleware( | |||
scope.add_event_processor(Box::new(move |event| process_event(event, &sentry_request))) | |||
}); | |||
|
|||
let state = request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: It's probably not hurting anything as is but we might wanna avoid cloning the entire ServerState
unless it's necessary. You could just pull out and clone solely the metrics
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll admit, I'm being a bit lazy here. .cloned()
does a clone if app_data()
returns Some. That saves a bit of complexity around dealing with .app_data()
returning None
for any reason.
if let Some(api_err) = error.as_error::<ApiError>() { | ||
if !api_err.kind.is_reportable() { | ||
debug!("Not reporting error (service error): {:?}", error); | ||
drop(_scope_guard); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do wonder if both this and the other drop are necessary but fine with leaving it for now 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just figuring we should include it in the execute path.
Covering two issues raised during the canary deploy of autopush-endpoint.
Due to rust's tighter typing requirements, we no longer accept quoted numerics in the VAPID JWT. The returned error would not give developers who are impacted by this change enough insight into what went wrong ("It was working before, what happened?") Added some text to the returned error message body to indicate what the cause of the new rejection is. (#CONSVC-1707 )
Many of the errors being logged to sentry from the new endpoint are not actionable. These are still errors, and require error handling, but do not need to be reported in detail. They can be converted to metrics. Added code to the sentry middleware to reduce the reporting load to sentry (#CONSVC-1708)