Koa

Our Koa integration only requires the installation of @sentry/node, and then you can use it like this:

Copied
import Koa from 'koa';
import * as Sentry from '@sentry/node';

// or using CommonJS
// const Koa = require('koa');
// const Sentry = require('@sentry/node');

const app = new Koa();

Sentry.init({ dsn: 'PUBLIC_DSN' });

app.on('error', (err, ctx) => {
  Sentry.withScope(function(scope) {
    scope.addEventProcessor(function(event) {
      return Sentry.Handlers.parseRequest(event, ctx.request);
    });
    Sentry.captureException(err);
  });
});

app.listen(3000);
You can edit this page on GitHub.