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

Bug/1707 ez vapid #299

Merged
merged 5 commits into from
Mar 21, 2022
Merged

Bug/1707 ez vapid #299

merged 5 commits into from
Mar 21, 2022

Conversation

jrconlin
Copy link
Member

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)

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
@jrconlin jrconlin requested review from pjenvey and a team March 18, 2022 17:27
autoendpoint/src/extractors/subscription.rs Outdated Show resolved Hide resolved
@@ -22,22 +23,46 @@ pub fn sentry_middleware(
scope.add_event_processor(Box::new(move |event| process_event(event, &sentry_request)))
});

let state = request
Copy link
Member

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.

Copy link
Member Author

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);
Copy link
Member

@pjenvey pjenvey Mar 18, 2022

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 🤷‍♂️

Copy link
Member Author

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.

autoendpoint/src/error.rs Outdated Show resolved Hide resolved
autoendpoint/src/extractors/subscription.rs Outdated Show resolved Hide resolved
autoendpoint/src/error.rs Outdated Show resolved Hide resolved
@jrconlin jrconlin merged commit 3d18b10 into master Mar 21, 2022
@jrconlin jrconlin deleted the bug/1707-ez-vapid branch March 21, 2022 15:05
@jrconlin jrconlin mentioned this pull request Mar 22, 2022
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.

2 participants