Enabling Raven / Sentry integration in a Loopback app

604 views
Skip to first unread message

Dalibor Karlović

unread,
May 4, 2016, 5:37:45 AM5/4/16
to LoopbackJS
I'm trying to setup a Raven-based client in my Loopback app using existing instructions for Express. This uses a middleware approach as shown there, but I'm having trouble interpreting the proper way of doing it inside a Loopback app.

I've added a snippet like this:


var sentry_dsn = process.env.SENTRY_DSN;
if (sentry_dsn) {
app.use(raven.middleware.express.requestHandler(sentry_dsn));
app.use(raven.middleware.express.errorHandler(sentry_dsn));
}

at the top of server.js, but it messed up my other middleware. Also found this as a all-around solution to this problem, but I can't figure out how to properly hook everything up.

If anybody has a tip or experience with it, I'd love to hear about it. Thanks.

Christopher Speer

unread,
May 19, 2016, 2:20:53 PM5/19/16
to loopb...@googlegroups.com
I got the same problem. No errors actually get sent to Sentry, so I'm quite stuck. I tried other approaches and even tried to capture any error myself by subscribing to the error event:
app.use(function onError(err, req, res, next) {
 
// whatever
});


But as it turns out, this never gets fired. So, my guess is that it's why Raven / Sentry doesn't work. The error event never gets fired.

Any ideas from the loopback team?

Thanks,
Chris

Christopher Speer

unread,
Jun 11, 2016, 8:16:34 AM6/11/16
to LoopbackJS
Hi there Dalibor,

we figured it out over at the nodedjs sentry github repo:

Hope this helps!

Cheers!


On Wednesday, May 4, 2016 at 11:37:45 AM UTC+2, Dalibor Karlović wrote:
Reply all
Reply to author
Forward
0 new messages