const { sentry } = config;
if (sentry) {
if (sentry.dsn) {
// Configure Raven
Raven.config(sentry.dsn).install();
// The request handler must be the first middleware on the app
app.use(Raven.requestHandler());
// The error handler must be before any other error middleware
app.use(Raven.errorHandler());
}
}
We opt to store our dsn values in a config file specific to environment.
An example of a config file might look like (Values found in your Sentry Account):
module.exports = {
env: 'dev',
http: 8080,
sentry: {
clientDsn: 'https://1111111@sentry.io/22222',
dsn: 'https://11111:2222222@sentry.io/33333333'
}
};
This should be done as early in the process as possible, essentially as soon as you initialize
app
you should be initializing Sentry to ensure you capture exceptions at all levels.
Reference: Sentry Implementation Notes
Recent Comments