Express

Quickly Identify and Fix Express Errors with Airbrake

Start Free Trial

Express Error & Performance Monitoring

Using Airbrake with Express.js

This example Node.js application uses Express.js and sets up Airbrake to report errors and performance data. To adapt this example to your app, follow these steps:

  1. Install the package:

npm install @airbrake/node

  1. Includethe required Airbrake libraries in your  app.js :

const Airbrake = require('@airbrake/node');
const airbrakeExpress = require('@airbrake/node/dist/instrumentation/express');

  1. ConfigureAirbrake with your project's credentials:

const airbrake = new Airbrake.Notifier({
 projectId: process.env.AIRBRAKE_PROJECT_ID,
 projectKey: process.env.AIRBRAKE_PROJECT_KEY,
});

  1. This middleware should be added before any routes are defined:

app.use(airbrakeExpress.makeMiddleware(airbrake));

  1. The error handler middleware should be defined last. For more info on how thisworks, see the official Express error handling doc.

app.use(airbrakeExpress.makeErrorHandler(airbrake));

  1. The last step is to run your app. To test that you've configured Air brake correctly, you can throw an error inside any of your routes:

app.get('/hello/:name', function hello(_req, _res) {
 throw new Error('Hello from Airbrake!');
});

Any unhandled errors that are thrown will now be reported to Airbrake. See the basic usage to learn how to manually send errors to Airbrake.

Note: To see this all in action, take a look at our example app.js file and to run the example, follow the next steps.

Running the example app

If you want to run this example application locally, follow these steps:

  1. Clone the airbrake-js repo:

git clone git@github.com:airbrake/airbrake-js.git

  1. Navigate to this directory:

cd airbrake-js/packages/node/examples/express

  1. Run the following commands while providing your `project ID` and `project API key`

npm install
AIRBRAKE_PROJECT_ID=your-id AIRBRAKE_PROJECT_KEY=your-key
node app.js
firefox localhost:3000

Frictionless error monitoring for Express

You monitor your servers and your apps, but is anyone monitoring your user experience? Every minute that your customer experience is compromised costs you more than just money. It costs you goodwill. Airbrake Express Error Monitoring can help.

Capturing Express errors is easy with the Airbrake Express Error Monitoring and Debugging tool. Airbrake installs in minutes and monitors your Express applications 24 hours/day, 7 days/week, notifying you in real-time of new errors occurrences. Detailed stack traces, environment, and user reports make Express error handling simple. With Airbrake, there's no need to sift through massive log reports for that elusive error. Instead, you’ll receive instant insight into the line of code that broke, the environment in which it occurred, and the deployment it's tied to.

Airbrake makes drilling down and understanding what's happening with your Express app easy. You can quickly fix error issues using:

Stack traces, parameters, and affected users - locate, assess, and resolve errors in a timely manner
  • Find exactly where an error is and the code that led up to it with Airbrake stack traces.
  • Parameters make it simple to group errors by their severity tags.
  • See who was affected by an error with aggregations comprising of remote addresses, countries, browsers, server hostnames, and more.
Error trends and deploy tracking - simplifying the job of managing and triaging errors
  • Deploy tracking is perfect when you need to see the relationship between errors and deploys.
  • The “Deploy” tab simplifies error data into graphs.
  • Keep track of who is pushing what deploys and any errors that are introduced.
  • Discover increases and decreases in errors via the “Trends” tab.
Custom workflow integrations - collaborate with your team to prioritize and triage errors
  • Integrate with your favorite application such as Slack, Trello, GitHub, etc.
  • Leave comments for your team about specific errors using the Airbrake comment feature.
  • Customize notifications to ensure you only receive messages about errors that matter.
  • Mute any errors you already know about or are considered low priority.
Performance monitoring - keep a close eye on the health of your Express application
  • Airbrake Express Performance Monitoring works with your application to monitor its health.
  • With Performance Monitoring for developers, you’ll have access to important tools which measure the UX of your application, latency, and error occurrences.
  • Under the “Jobs” tab, see a list of your Jobs and how well they’re performing within your application.
Security - Airbrake offers robust security to protect your data    
  • Airbrake is certified in all of the following areas: GDPR, EU-US Privacy Shield Framework, and SOC II Type 2.  
  • Airbrake supports both TLS Protocol v. 1.2 and v. 1.3.
  • Use SAML Single-Sign-On to access your Airbrake Account.

Finding the root cause of your application exceptions is easier than ever with Airbrake Express. Airbrake assists you in locating an error's file, the method, and even the line of code. With proprietary and customizable grouping algorithms, cutting through the noise and focusing on fixing the errors that matter most has never been so easy. Let Airbrake help you handle errors so you can get back to the business of delighting your users. Try Airbrake free with a free trial; no credit card required!

This will make the text black in colour with the font, Inconsolata.
This will make the text pink in colour with the font, Inconsolata.
This is the h6 heading.
This will make the text black in colour with the font, Inconsolata; size 20px.
This will make the text yellow in colour with the font, Inconsolata; size 20px.
KEY FEATURES:
  • Blazing fast, real-time errors alerts
  • Lightweight notifier installs quickly and won't impact your app performance
  • Receive error notifications via email, Slack, or webhooks
  • Fast error search and filtering within your Airbrake dashboard
  • Advanced data security including SOC-2 Compliance and SAML Single Sign-On - included with all Airbrake plans
  • Integrates with GitHub, Trello, Slack, JIRA, Pivotal Tracker, GitHub Enterprise, GitLab, GitLab CE/EE, Bitbucket, custom webhooks, and other 3rd party apps
  • Dupe error detection
  • Customizable error filtering
  • Unlimited users and projects
  • Comprehensive read & write API
  • Deploy tracking to monitor code quality
  • Performance insight about your total app health including your code, production environment, and the user experience.