Rollbar
Integrating Rollbar for real-time error monitoring, deploy tracking, and automated error grouping across server and client applications
You are an expert in integrating Rollbar for error tracking and crash reporting. ## Key Points - Set `codeVersion` or `code_version` to the git SHA or semantic version so errors map to exact code states. - Use deploy tracking to correlate error spikes with specific releases and quickly identify regressions. - Leverage RQL for advanced queries when the standard dashboard filters are insufficient. - Set different access tokens for client-side vs. server-side to maintain proper security boundaries. - Configure rate limits per environment to prevent runaway error loops from exhausting your quota. - Using a server-side token in client-side JavaScript, exposing write access to your Rollbar project. - Not enabling `captureUncaught` and `captureUnhandledRejections`, missing unhandled errors entirely. - Forgetting to set `source_map_enabled: true` in the client config, even after uploading source maps. - Uploading source maps with an incorrect `minified_url` that does not match the URL the browser loads. - Not recording deploys, losing the ability to correlate error spikes with releases. ## Quick Example ```bash npm install rollbar ``` ```bash npm install rollbar react-rollbar ```
skilldb get error-tracking-services-skills/RollbarFull skill: 230 linesRollbar — Error Tracking
You are an expert in integrating Rollbar for error tracking and crash reporting.
Core Philosophy
Overview
Rollbar is an error monitoring platform emphasizing real-time alerting, intelligent error grouping, and deploy tracking. It supports major languages and frameworks, provides AI-assisted grouping to reduce noise, and integrates tightly with CI/CD pipelines for deploy-correlated error analysis. Use Rollbar when you want fast time-to-resolution with automated grouping and strong deploy tracking.
Setup & Configuration
JavaScript Browser
npm install rollbar
import Rollbar from "rollbar";
const rollbar = new Rollbar({
accessToken: "YOUR_CLIENT_TOKEN",
environment: process.env.NODE_ENV,
captureUncaught: true,
captureUnhandledRejections: true,
payload: {
client: {
javascript: {
source_map_enabled: true,
code_version: "1.2.0",
guess_uncaught_frames: true,
},
},
},
});
export default rollbar;
React Integration
npm install rollbar react-rollbar
import { Provider, ErrorBoundary } from "@rollbar/react";
const rollbarConfig = {
accessToken: "YOUR_CLIENT_TOKEN",
environment: "production",
};
const App = () => (
<Provider config={rollbarConfig}>
<ErrorBoundary>
<MyApp />
</ErrorBoundary>
</Provider>
);
Node.js
npm install rollbar
const Rollbar = require("rollbar");
const rollbar = new Rollbar({
accessToken: "YOUR_SERVER_TOKEN",
environment: process.env.NODE_ENV,
codeVersion: "1.2.0",
});
Express Middleware
const express = require("express");
const Rollbar = require("rollbar");
const rollbar = new Rollbar({ accessToken: "YOUR_SERVER_TOKEN" });
const app = express();
// Your routes here
// Error handler — must be after all routes
app.use(rollbar.errorHandler());
Core Patterns
Error Capturing
// Capture an error
try {
riskyOperation();
} catch (error) {
rollbar.error(error);
}
// Log levels: debug, info, warning, error, critical
rollbar.critical("Database connection lost");
rollbar.warning("Deprecated API endpoint called", { endpoint: "/v1/users" });
Context and Breadcrumbs
// Add custom data to an error report
rollbar.error("Payment failed", {
orderId: "abc-123",
amount: 49.99,
gateway: "stripe",
});
// Configure telemetry (breadcrumbs)
const rollbar = new Rollbar({
accessToken: "YOUR_TOKEN",
autoInstrument: {
log: true,
dom: true,
navigation: true,
connectivity: true,
},
});
User Identification
rollbar.configure({
payload: {
person: {
id: "user-42",
email: "user@example.com",
username: "janedoe",
},
},
});
Release and Deploy Tracking
# Notify Rollbar of a deploy
curl https://api.rollbar.com/api/1/deploy/ \
-F access_token=YOUR_SERVER_TOKEN \
-F environment=production \
-F revision=$(git rev-parse HEAD) \
-F local_username=$(whoami)
Source Maps
# Upload source maps
curl https://api.rollbar.com/api/1/sourcemap \
-F access_token=YOUR_SERVER_TOKEN \
-F version=1.2.0 \
-F minified_url=https://example.com/js/app.min.js \
-F source_map=@dist/app.min.js.map
Advanced Features
Telemetry / Breadcrumbs
Rollbar automatically captures DOM events, console logs, network requests, and navigation changes as telemetry events. These appear as a timeline on each error occurrence, showing what happened before the crash.
RQL (Rollbar Query Language)
-- Find errors affecting a specific user
SELECT * FROM item_occurrence
WHERE person.id = 'user-42'
AND timestamp > unix_timestamp() - 86400
-- Count errors by browser
SELECT client.javascript.browser, count(*)
FROM item_occurrence
GROUP BY client.javascript.browser
Merge and Unmerge Items
Rollbar's AI-powered grouping automatically clusters related errors. You can manually merge items that represent the same root cause or unmerge items that were incorrectly grouped.
Versions and Deploys Dashboard
Track error rates per deploy. Rollbar highlights which deploy introduced new errors and shows error count trends relative to each release.
Best Practices
- Set
codeVersionorcode_versionto the git SHA or semantic version so errors map to exact code states. - Use deploy tracking to correlate error spikes with specific releases and quickly identify regressions.
- Leverage RQL for advanced queries when the standard dashboard filters are insufficient.
- Set different access tokens for client-side vs. server-side to maintain proper security boundaries.
- Configure rate limits per environment to prevent runaway error loops from exhausting your quota.
Common Pitfalls
- Using a server-side token in client-side JavaScript, exposing write access to your Rollbar project.
- Not enabling
captureUncaughtandcaptureUnhandledRejections, missing unhandled errors entirely. - Forgetting to set
source_map_enabled: truein the client config, even after uploading source maps. - Uploading source maps with an incorrect
minified_urlthat does not match the URL the browser loads. - Not recording deploys, losing the ability to correlate error spikes with releases.
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
Airbrake
Integrating Airbrake for error monitoring, performance tracking, and deploy management across web and backend applications
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