Installing Airbrake in a Node.js app

node flag


  • 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


Step 1: Add the library

Add the Airbrake error notifier to your package.json then run npm install from your project’s directory:

  "dependencies": {
    "airbrake-js": "^1.4.6"

Or install the notifier manually

Step 2: Configure the library

This is a simple Node app app.js file that throws an error and sends it to Airbrake. To configure Airbrake in your project, just require the airbrake-js library and instantiate the client as shown:

var http = require('http');
var AirbrakeClient = require('airbrake-js');

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
  throw new Error('I am an uncaught exception');

console.log('Server running on port 8080.');

var airbrake = new AirbrakeClient({
  projectId: 'Your Project ID',
  projectKey: 'Your Project API Key'

For our full Node example app code and more information, please visit our official GitHub repo.