Installing Airbrake in a JavaScript 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

Supported frameworks


Using npm

npm install airbrake-js

Using Bower

bower install airbrake-js-client

Basic Usage

First you need to initialize notifier with project id and API key taken from

var airbrake = new airbrakeJs.Client({projectId: 1, projectKey: 'abc'});

Or if you are using browserify/webpack/etc:

var airbrakeJs = require('airbrake-js');
var airbrake = new airbrakeJs({projectId: 1, projectKey: 'abc'});

The simplest method is to report errors directly:

try {
  // This will throw if the document has no head tag
} catch(err) {
  throw err;

Alternatively you can wrap any code which may throw errors using the client’s wrap method:

var startApp = function() {
  // This will throw if the document has no head tag.
startApp = airbrake.wrap(startApp);

// Any exceptions thrown in startApp will be reported to Airbrake.

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.