@sentry/browser
@sentry/node
raven-js
raven-node
_(raven for node)_2.6.4
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?
I don't see strong-error-handler
anywhere in the code you provide. There's a note about it on the docs page
If you鈥檙e using Loopback 2.x LTS, make sure you鈥檝e migrated to strong-error-handler, otherwise no errors will get to raven-node.
Hello,
I did try using strong-error-handler
but sentry still doesn't create any issues
But as you say it is for Loopback 2.x and as mentioned I am using the latest Loopback 3.22.3
I realized that, but strong-error-handler
is used in all versions >= v2.
Are you able to provide a reproducible test-case I could use to debug this?
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 to raven.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.
No rush, I'll leave this issue open till then :) (unless it takes months :p)
Closing due to inactivity 馃槄 Feel free to reopen if it's still relevant.
Most helpful comment
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.