Loopback & Raven not working together
See original GitHub issue- Review the documentation: https://docs.sentry.io/
- Search for existing issues: https://github.com/getsentry/sentry-javascript/issues
- Use the latest release: https://github.com/getsentry/sentry-javascript/releases
Package + Version
-
@sentry/browser
-
@sentry/node
-
raven-js
-
raven-node
(raven for node) - other:
Version:
2.6.4
Description
Using latest loopback and raven
"loopback": "3.22.3"
"raven": "2.6.4"
Followed these docs for integrating with loopback
https://docs.sentry.io/clients/node/integrations/loopback/
server.js
looks like this:
const raven = require('raven');
raven.config(
process.env.SENTRY_DSN, {
captureUnhandledRejections: true,
environment: process.env.NODE_ENV
}).install();
/server/middleware.json
looks like this:
"final:after": {
"raven#errorHandler": {}
}
Inside /node_modules/raven/lib/client.js
there is an errorHandler
function.
errorHandler
is getting attached, but ravenErrorMiddleware
is not getting called.
errorHandler: function() {
var self = this;
return function ravenErrorMiddleware(err, req, res, next) {
I am able to generate issues in sentry before the booting the application.
For example if I were to add some non-existent middleware called blahblah
:
"final:after": {
"raven#errorHandler": {},
"blahblah": {}
}
The app instantly crashes and I get the error Error: Cannot resolve path "blahblah"
as an issue within sentry.
But any errors thrown within the app itself are not caught by sentry.
Any ideas on what I’m doing wrong here?
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
For now I’m using a work around.
I’ve made a mixin that uses the Loopback hook
afterRemoteError
to catch any errors and then passes the context toraven.captureException
to create a sentry issue.I will find some time to make a reproducible test case but I’m not sure when that will be yet. Sorry for not being able to provide it sooner.
Closing due to inactivity 😅 Feel free to reopen if it’s still relevant.