Nodejs Express Global error is not sending by sentry

I am trying to integrate sentry with Raven in Nodejs express. I am using promises in all of my routes and some routes are there without promises too. I setup sentry/raven as per your documentation in app.js file in nodejs.

var Raven = require(‘raven’);
var app = = express();

When I throw any error from the route, sentry not catching that error. But if I use Raven.captureException(e); in the code (manually) then it catches and sends the error. I want Sentry to send the errors wherever occurred in the application globally. Am I missing something in the implementation?

1 Like

That code looks fine. How do you setup your routes? Can you provide the smallest possible code example that can reproduce this issue? Also package.json dependencies list would be useful.

by default, promise rejections aren’t reported to sentry. you should set captureUnhandledRejections: true
and see if that helps

1 Like