-
Notifications
You must be signed in to change notification settings - Fork 45
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
ApiErrors from middlewares aren't reported to sentry #504
Labels
Projects
Comments
pjenvey
added
bug
Something isn't working
5
Estimate - l - Moderately complex, will require some effort but clearly defined.
labels
Mar 19, 2020
jrconlin
added a commit
that referenced
this issue
Apr 22, 2020
Actix currently discards any errors generated in the middleware. You are supposed to pass them in the body or some similar sub-optimal means. Not a super fan of this approach, but basically, this patch attaches a the error to the request or response extensions bucket. Since sentry is also a middleware and gets run on every response, it sweeps the request/response extension buckets and reports any errors it finds. This has the downside that some context may be lost from the error (e.g. I STRONGLY suspect the backtrace will be useless) WIP Closes #504
jrconlin
added a commit
that referenced
this issue
Apr 24, 2020
Actix currently discards any errors generated in the middleware. You are supposed to pass them in the body or some similar sub-optimal means. Not a super fan of this approach, but basically, this patch attaches a the error to the request or response extensions bucket. Since sentry is also a middleware and gets run on every response, it sweeps the request/response extension buckets and reports any errors it finds. I created several new `ApiErrorKind`s to encapsulate the errors being generated by the middleware layers. Partly to help isolate them and partly to help any future filtering we may want to do. Closes #504
jrconlin
added a commit
that referenced
this issue
Jun 3, 2020
Actix currently discards any errors generated in the middleware. You are supposed to pass them in the body or some similar sub-optimal means. `debug!` statements have been added in the sentry middleware to note if an error has been detected and logged. You can trigger one such error (Bad Hawk Id) by starting a server and trying to fetch from `http://localhost:8000/test` Closes #504
pjenvey
pushed a commit
that referenced
this issue
Jun 9, 2020
* feat: log messages from middleware to sentry Actix currently discards any errors generated in the middleware. You are supposed to pass them in the body or some similar sub-optimal means. `debug!` statements have been added in the sentry middleware to note if an error has been detected and logged. You can trigger one such error (Bad Hawk Id) by starting a server and trying to fetch from `http://localhost:8000/test` Closes #504
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Despite
SentryMiddleware
being the outtermost/last middleware, it does not receive errors triggered from other middlewares.See actix-web#1051 for some discussion of this behavior.
These errors should be reported to sentry but it may be tricky to do so for all potential cases: e.g. carefully distinguishing between an ApiError from a handler that SentryMiddleware will report vs one from the middleware (especially amid the Future chains).
The more important ones to report are from
DbTransactionMiddleware
(from thedb.commit/rollback()
calls). A potential "good enough" fix here may be just adding special case reporting for those two.The text was updated successfully, but these errors were encountered: