Airbrake
Integrating Airbrake for error monitoring, performance tracking, and deploy management across web and backend applications
You are an expert in integrating Airbrake for error tracking and crash reporting. ## Key Points - Use `addFilter` to redact sensitive fields (passwords, tokens, credit card numbers) from every notice. - Track every deploy via the deploys API so you can correlate error spikes with specific releases. - Set `environment` consistently to separate production errors from staging and development noise. - Use severity levels to differentiate between warnings you can batch-review and critical errors needing immediate attention. - Keep `params` and `session` payloads focused on debugging-relevant data rather than dumping entire request bodies. - Not registering the error handler middleware after all routes in Express, causing errors to go unreported. - Forgetting to return `null` from a filter to suppress a notice (returning `undefined` does not suppress it). - Not setting up deploy tracking, losing the ability to correlate error volume changes with releases. - Embedding the project key directly in client-side code without understanding that it is inherently public; use a separate key with write-only permissions. - Not enabling `performanceStats`, missing out on route-level performance data that Airbrake can collect automatically. ## Quick Example ```bash npm install @airbrake/browser ``` ```bash npm install @airbrake/node ```
skilldb get error-tracking-services-skills/AirbrakeFull skill: 253 linesAirbrake — Error Tracking
You are an expert in integrating Airbrake for error tracking and crash reporting.
Core Philosophy
Overview
Airbrake is one of the original error tracking services, providing error monitoring and performance management. It offers straightforward error grouping, backtrace analysis, and deploy tracking. Airbrake supports Ruby, JavaScript, Python, Go, Java, and other languages. Use Airbrake when you want a mature, no-frills error tracker with built-in performance monitoring and a simple per-error pricing model.
Setup & Configuration
JavaScript Browser
npm install @airbrake/browser
import { Notifier } from "@airbrake/browser";
const airbrake = new Notifier({
projectId: 123456,
projectKey: "YOUR_PROJECT_KEY",
environment: "production",
});
export default airbrake;
Node.js
npm install @airbrake/node
const { Notifier } = require("@airbrake/node");
const airbrake = new Notifier({
projectId: 123456,
projectKey: "YOUR_PROJECT_KEY",
environment: process.env.NODE_ENV,
});
module.exports = airbrake;
Express Middleware
const express = require("express");
const { Notifier } = require("@airbrake/node");
const airbrake = new Notifier({
projectId: 123456,
projectKey: "YOUR_PROJECT_KEY",
});
const app = express();
// Your routes here
// Airbrake error handler — after all routes
app.use((err, req, res, next) => {
airbrake.notify({
error: err,
params: { route: req.path },
session: { userId: req.user?.id },
});
next(err);
});
React Error Boundary
import { Notifier } from "@airbrake/browser";
import React from "react";
const airbrake = new Notifier({
projectId: 123456,
projectKey: "YOUR_PROJECT_KEY",
});
class AirbrakeErrorBoundary extends React.Component {
componentDidCatch(error, info) {
airbrake.notify({
error,
params: { componentStack: info.componentStack },
});
}
render() {
return this.props.children;
}
}
Core Patterns
Error Capturing
// Notify Airbrake of a caught error
try {
riskyOperation();
} catch (error) {
airbrake.notify(error);
}
// Notify with additional parameters
airbrake.notify({
error: new Error("Payment failed"),
params: { orderId: "abc-123", gateway: "stripe" },
environment: { version: "1.2.0" },
});
Context and Breadcrumbs
// Add context via params and session in the notice
airbrake.notify({
error,
context: {
component: "CheckoutPage",
action: "processPayment",
},
params: { orderId: "abc-123" },
session: { userId: "user-42" },
});
User Identification
// Add user info via addFilter
airbrake.addFilter((notice) => {
notice.context.user = {
id: "user-42",
email: "user@example.com",
name: "Jane Doe",
};
return notice;
});
Release Tracking
# Track deploys via the Airbrake API
curl -X POST "https://api.airbrake.io/api/v4/projects/PROJECT_ID/deploys" \
-H "Authorization: Bearer YOUR_PROJECT_KEY" \
-H "Content-Type: application/json" \
-d '{
"environment": "production",
"username": "deployer",
"repository": "https://github.com/org/repo",
"revision": "abc123def",
"version": "1.2.0"
}'
Source Maps
Upload source maps through the Airbrake dashboard or API. Ensure the source map URLs match the paths served in production.
Advanced Features
Performance Monitoring (APM)
Airbrake APM tracks route performance, database queries, and external HTTP calls.
const { Notifier } = require("@airbrake/node");
const airbrake = new Notifier({
projectId: 123456,
projectKey: "YOUR_PROJECT_KEY",
performanceStats: true,
});
// For Express, Airbrake automatically instruments routes when performance is enabled
Filters
// Add a filter to modify or suppress notices
airbrake.addFilter((notice) => {
// Suppress specific errors
if (notice.errors[0].message.includes("ResizeObserver")) {
return null; // Do not send
}
// Scrub sensitive data
if (notice.params.password) {
notice.params.password = "[FILTERED]";
}
return notice;
});
Severity Levels
airbrake.notify({
error,
context: {
severity: "critical", // debug, info, notice, warning, error, critical
},
});
Grouping
Airbrake groups errors by backtrace fingerprint. You can customize grouping by modifying the error type or message in a filter to force specific grouping behavior.
Best Practices
- Use
addFilterto redact sensitive fields (passwords, tokens, credit card numbers) from every notice. - Track every deploy via the deploys API so you can correlate error spikes with specific releases.
- Set
environmentconsistently to separate production errors from staging and development noise. - Use severity levels to differentiate between warnings you can batch-review and critical errors needing immediate attention.
- Keep
paramsandsessionpayloads focused on debugging-relevant data rather than dumping entire request bodies.
Common Pitfalls
- Not registering the error handler middleware after all routes in Express, causing errors to go unreported.
- Forgetting to return
nullfrom a filter to suppress a notice (returningundefineddoes not suppress it). - Not setting up deploy tracking, losing the ability to correlate error volume changes with releases.
- Embedding the project key directly in client-side code without understanding that it is inherently public; use a separate key with write-only permissions.
- Not enabling
performanceStats, missing out on route-level performance data that Airbrake can collect automatically.
Anti-Patterns
Over-engineering for hypothetical scale. Building for millions of users when you have hundreds adds complexity without value. Solve today's problems first.
Ignoring the existing ecosystem. Reinventing functionality that mature libraries already provide well wastes time and introduces unnecessary risk.
Premature abstraction. Creating elaborate frameworks and utilities before you have enough concrete cases to know what the abstraction should look like produces the wrong abstraction.
Neglecting error handling at boundaries. Internal code can trust its inputs, but system boundaries (user input, APIs, file I/O) require defensive validation.
Skipping documentation for obvious code. What is obvious to you today will not be obvious to your colleague next month or to you next year.
Install this skill directly: skilldb add error-tracking-services-skills
Related Skills
Bugsnag
Integrating Bugsnag for application stability monitoring, error tracking, and release health across web and mobile platforms
Datadog Rum
Integrating Datadog Real User Monitoring for frontend error tracking, performance monitoring, and session replay within the Datadog observability platform
Highlight
Integrating Highlight.io for open-source session replay, error monitoring, and log management with full-stack observability
Honeybadger
Integrating Honeybadger for exception monitoring, uptime checks, and check-in monitoring with minimal configuration overhead
Logrocket
Integrating LogRocket for session replay, frontend error tracking, and product analytics to understand exactly what users experience
Rollbar
Integrating Rollbar for real-time error monitoring, deploy tracking, and automated error grouping across server and client applications