Installing Airbrake in an Express application


  • Easy and flexible installation options including NPM, Bower and a public CDN
  • Send uncaught errors to Airbrake or manually using a try/catch
  • Add custom parameters to your errors for more context
  • Private sourcemap support
  • Control which errors you send with customizable filtering options


Using npm

npm install airbrake-js

Using Bower

bower install airbrake-js-client


After you have installed the airbrake-js notifier the next step is configuring Airbrake in your Express app. Configuration involves creating an AirbrakeClient with your projectId and projectKey and registering an Express error handler. The error handler should be registered below all other app.use() and routes calls.

Configuring in an example Express app

Here is the configuration for an example Express app, this app throws and reports an error to Airbrake when you visit localhost:3000. You will want to replace the placeholder projectId and projectKey with the real values from your project’s settings page.

var express = require('express');
var AirbrakeClient = require('airbrake-js');
var makeErrorHandler = require('airbrake-js/dist/instrumentation/express');

var app = express();

app.get('/', function hello (req, res) {
  throw new Error('hello from Express');
  res.send('Hello World!');

var airbrake = new AirbrakeClient({
  projectId: 1,
  projectKey: 'FIXME',

// Error handler middleware should be the last, after other app.use() and routes calls.

app.listen(3000, function () {
  console.log('Example app listening on port 3000!');

Going Further

Installation and configuration is just the beginning. The airbrake-js notifier supports many other advanced uses and options including:

Please visit the airbrake-js GitHub repo for more usage and configuration examples.