Rollbar Error Monitoring: CI/CD Integration and Deployment Tracking
The hardest part of shipping software is not writing it — it's knowing whether what you shipped is working. Deployment pipelines that run tests, pass CI, and complete without errors frequently deploy broken software. The tests passed because they tested the wrong things, or because the production environment differs from the test environment in a critical way.
Rollbar addresses this by monitoring what actually happens in production after a deployment. Its deploy tracking, real-time error monitoring, and CI/CD integrations create a feedback loop: deploy, observe, confirm or roll back.
This guide focuses on Rollbar's deployment-oriented features and how to integrate them into CI/CD pipelines.
Rollbar's Core Architecture
Rollbar captures exceptions and errors from your application in real time, groups them into items (one item per unique error), and tracks their occurrence over time. Each item shows:
- When it first occurred
- When it last occurred
- How many times it's occurred
- How many users are affected
- Which deployments were active when it occurred
- Full stack traces for each occurrence
The deployment association is Rollbar's key differentiator. When you report a deploy, Rollbar annotates your error timeline with deployment events. You can immediately see: did this error start occurring after the last deployment? Or was it present before?
SDK Installation
JavaScript/Node.js:
const Rollbar = require('rollbar');
const rollbar = new Rollbar({
accessToken: 'YOUR_POST_SERVER_ITEM_TOKEN',
environment: process.env.NODE_ENV || 'development',
captureUncaught: true,
captureUnhandledRejections: true,
payload: {
code_version: process.env.GIT_SHA,
},
});
// Express middleware
app.use(rollbar.errorHandler());
// Manual error capture
try {
riskyOperation();
} catch (err) {
rollbar.error(err, { context: 'payment processing' });
}Python/Django:
import rollbar
import rollbar.contrib.django.middleware
rollbar.init(
access_token='YOUR_POST_SERVER_ITEM_TOKEN',
environment='production',
code_version=os.environ.get('GIT_SHA'),
root=os.path.dirname(os.path.realpath(__file__)),
)
# Django settings.py
MIDDLEWARE = [
'rollbar.contrib.django.middleware.RollbarNotifierMiddleware',
# ... other middleware
]
ROLLBAR = {
'access_token': os.environ.get('ROLLBAR_ACCESS_TOKEN'),
'environment': os.environ.get('DJANGO_ENV', 'development'),
'code_version': os.environ.get('GIT_SHA'),
'root': BASE_DIR,
}React:
import Rollbar from 'rollbar';
import { Provider, ErrorBoundary } from '@rollbar/react';
const rollbarConfig = {
accessToken: 'YOUR_CLIENT_ITEM_TOKEN',
environment: process.env.REACT_APP_ENV,
code_version: process.env.REACT_APP_GIT_SHA,
captureUncaught: true,
captureUnhandledRejections: true,
};
function App() {
return (
<Provider config={rollbarConfig}>
<ErrorBoundary fallbackUI={ErrorPage}>
<YourApp />
</ErrorBoundary>
</Provider>
);
}Deploy Tracking
Deploy tracking is the centerpiece of Rollbar's CI/CD integration. Report each deployment to Rollbar's Deploy API:
curl -X POST https://api.rollbar.com/api/1/deploy \
-H "X-Rollbar-Access-Token: YOUR_POST_SERVER_ITEM_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"environment": "production",
"revision": "'"$GIT_SHA"'",
"rollbar_username": "'"$DEPLOYER_USERNAME"'",
"local_username": "deploy-bot",
"comment": "'"$DEPLOY_MESSAGE"'",
"status": "succeeded"
}'Rollbar also accepts status: "started" (before deployment) and then a second call with status: "succeeded" or status: "failed" after completion. This lets Rollbar track deployment duration and show in-flight deployments in the timeline.
GitHub Actions integration:
jobs:
deploy:
steps:
- name: Notify Rollbar deploy started
run: |
curl -X POST https://api.rollbar.com/api/1/deploy \
-H "X-Rollbar-Access-Token: ${{ secrets.ROLLBAR_ACCESS_TOKEN }}" \
-H "Content-Type: application/json" \
-d '{
"environment": "production",
"revision": "${{ github.sha }}",
"rollbar_username": "${{ github.actor }}",
"status": "started"
}'
- name: Deploy application
# ... deployment steps ...
- name: Notify Rollbar deploy succeeded
if: success()
run: |
curl -X POST https://api.rollbar.com/api/1/deploy \
-H "X-Rollbar-Access-Token: ${{ secrets.ROLLBAR_ACCESS_TOKEN }}" \
-H "Content-Type: application/json" \
-d '{
"environment": "production",
"revision": "${{ github.sha }}",
"status": "succeeded"
}'
- name: Notify Rollbar deploy failed
if: failure()
run: |
curl -X POST https://api.rollbar.com/api/1/deploy \
-H "X-Rollbar-Access-Token: ${{ secrets.ROLLBAR_ACCESS_TOKEN }}" \
-H "Content-Type: application/json" \
-d '{
"environment": "production",
"revision": "${{ github.sha }}",
"status": "failed"
}'Active Deployment Monitoring
Once deploy tracking is configured, Rollbar's Active Deployments feature shows real-time error activity for your most recent deployment. During the first hour after deployment, you get a condensed view:
- New errors (first seen in this deployment)
- Reactivated errors (were resolved, now occurring again)
- Ongoing errors (present before deployment, still occurring)
This triage view answers the question deployment teams care about immediately after shipping: "Did we break anything?"
For release-critical deployments, monitoring the Active Deployments view for 15-30 minutes post-deploy is a standard operational practice. A clean deploy shows no new errors and no reactivated resolved items.
Source Map Upload
Production JavaScript is minified and bundled. Stack traces from production errors point to minified code — unreadable without source maps. Rollbar's source map upload transforms these into your original source file references.
Using the Rollbar CLI:
npm install -g @rollbar/cli
rollbar-cli upload-sourcemaps ./dist \
--access-token $ROLLBAR_ACCESS_TOKEN \
--version $GIT_SHA \
--base-url https://yourapp.com/static/Webpack plugin:
const RollbarSourceMapPlugin = require('rollbar-sourcemap-webpack-plugin');
module.exports = {
devtool: 'hidden-source-map',
plugins: [
new RollbarSourceMapPlugin({
accessToken: process.env.ROLLBAR_ACCESS_TOKEN,
version: process.env.GIT_SHA,
publicPath: 'https://yourapp.com/static/',
}),
],
};Source maps must be uploaded before or shortly after deployment, and before any production errors occur, to ensure traces are properly de-minified.
Person Tracking
Attaching user identity to error events is essential for impact analysis:
// Client-side
rollbar.configure({
payload: {
person: {
id: currentUser.id,
username: currentUser.username,
email: currentUser.email,
}
}
});
// Server-side (per-request)
rollbar.configure({
payload: {
person: {
id: req.user.id,
email: req.user.email,
}
}
});With person tracking enabled, each error shows an affected users count. You can search for all errors affecting a specific user — useful when a customer reports a problem and you need to understand their full error history.
Workflow Integration
Rollbar integrates with GitHub, GitLab, Jira, PagerDuty, Slack, and others.
GitHub integration: Links Rollbar items to GitHub commits and pull requests. When a commit is associated with an error, Rollbar shows the commit message and changed files. If you close an item resolved by a commit, Rollbar can automatically reopen it if the error recurs in a later deployment.
Jira integration: Create Jira tickets from Rollbar errors with one click, pre-populated with stack traces, occurrence counts, affected users, and environment details.
Slack alerts: Configurable notifications for new errors, error spikes, or stability threshold breaches.
PagerDuty/OpsGenie: Escalate critical errors to on-call rotation automatically.
Versioning and Environments
Rollbar separates errors by environment (development, staging, production) and by code version. This separation is important:
- Errors in development don't pollute your production dashboard
- You can compare error rates between code versions
- Errors can be resolved at a specific version — if a bug is fixed in 1.5.0, Rollbar tracks whether it reappears in subsequent versions
Configure environments explicitly:
const rollbar = new Rollbar({
accessToken: 'YOUR_TOKEN',
environment: process.env.NODE_ENV,
// Only report errors in production and staging
enabled: ['production', 'staging'].includes(process.env.NODE_ENV),
code_version: process.env.GIT_SHA,
});Testing Your Rollbar Integration
Before relying on Rollbar in production, verify your integration:
// Send a test error
rollbar.debug('Test from integration validation');
rollbar.info('Rollbar integration confirmed', { environment: 'staging' });
// Verify manual error capture
try {
throw new Error('Integration test error');
} catch (err) {
rollbar.error(err, (err, data) => {
console.log('Reported error UUID:', data.result.uuid);
});
}Verify in the Rollbar dashboard that:
- The test events appear in the correct environment
- Stack traces are properly de-minified (requires source maps)
- User context is attached (if person tracking is configured)
- Deploy annotations appear on the timeline
QA Checklist for Rollbar Integration
- Rollbar SDK installed and initialized in all services
- Separate API tokens for production and staging environments
- Person tracking configured for user impact analysis
- Source maps uploading as part of build/deploy pipeline
- Deploy notifications configured in deployment pipeline
- Alert thresholds configured (new errors, error spikes)
- Team notification channels set up (Slack/PagerDuty)
- GitHub/GitLab integration configured for commit linking
- Error sampling configured if needed for high-volume services
- Sensitive data scrubbing configured for PII fields
With this configuration, Rollbar provides a closed loop between code changes and production error behavior — making it straightforward to validate that deployments don't degrade production quality and to respond quickly when they do.