Registry / observability / rollbar-cli

rollbar-cli

JSON →
library0.2.1jsnpmunverified

The `rollbar-cli` package provides a command-line interface for interacting with the Rollbar API, focusing on critical development and deployment tasks. Its primary functions include uploading JavaScript source maps and notifying Rollbar of new code deployments. The current stable version is 0.2.1, which primarily includes an internal dependency security fix. While a formal release cadence isn't explicitly defined, updates appear to be driven by feature additions or security patches as needed. Key differentiators lie in its direct integration with the Rollbar platform, simplifying the workflow for developers needing to associate minified production code with its original source for debugging, and to track deployment lifecycles. It offers both traditional source map uploads and a newer method (since v0.2.0) for zipping and uploading multiple maps as a single file.

npm install rollbar-cli
INSTALL
IMPORT
SIG · ROLLBAR-CLI
R
rollbar-cli
observabilityjavascriptv0.2.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Demonstrates how to programmatically execute `rollbar-cli` commands to upload source maps and notify a deployment from a Node.js script, suitable for CI/CD pipelines.

import { execSync } from 'child_process'; import path from 'path'; const ROLLBAR_ACCESS_TOKEN = process.env.ROLLBAR_ACCESS_TOKEN ?? ''; const ROLLBAR_URL_PREFIX = 'https://cdn.example.com/assets/'; // Must match your asset host const ROLLBAR_CODE_VERSION = process.env.GIT_SHA ?? '1.0.0'; // Unique version for your code const BUILD_DIR = path.resolve(__dirname, './dist'); // Your compiled output directory const ROLLBAR_ENVIRONMENT = 'production'; if (!ROLLBAR_ACCESS_TOKEN) { console.error('Error: ROLLBAR_ACCESS_TOKEN environment variable is not set.'); process.exit(1); } function runCliCommand(command: string) { try { console.log(`Executing: rollbar-cli ${command}`); const output = execSync(`rollbar-cli ${command}`, { encoding: 'utf8', stdio: 'inherit' }); console.log(output); } catch (error: any) { console.error(`Failed to execute Rollbar CLI command: ${command}`); console.error(error.message); process.exit(1); } } // 1. Upload source maps runCliCommand(`upload-sourcemaps ${BUILD_DIR} \ --access-token ${ROLLBAR_ACCESS_TOKEN} \ --url-prefix '${ROLLBAR_URL_PREFIX}' \ --code-version ${ROLLBAR_CODE_VERSION} \ --next`); // Using the --next option for zip upload // 2. Notify Rollbar of a successful deployment runCliCommand(`notify-deploy \ --access-token ${ROLLBAR_ACCESS_TOKEN} \ --code-version ${ROLLBAR_CODE_VERSION} \ --environment ${ROLLBAR_ENVIRONMENT} \ --status succeeded`); console.log('\nRollbar CLI operations completed successfully.');
rollbar-cli --version
Debug
Known issues
gotchaAll commands (e.g., `upload-sourcemaps`, `notify-deploy`) require specific arguments that must be provided to avoid failures. Common omissions include `--access-token`, `--url-prefix`, `--code-version`, and `--environment`.
fix
Always review the command help (`rollbar-cli <command> --help`) and provide all mandatory options with their correct values. For sensitive data like `--access-token`, consider using environment variables.
affects: >=0.1.0
gotchaThe `--url-prefix` and `--code-version` options for `upload-sourcemaps` are critical for Rollbar to correctly match source maps. Mismatches will prevent stack traces from symbolication, making errors unreadable.
fix
Ensure `--url-prefix` exactly matches the base URL of your assets in production stack traces, and `--code-version` matches the value sent with your Rollbar error items (e.g., from your Rollbar.js configuration).
affects: >=0.1.0
gotchaVersion 0.2.0 introduced a new source map upload method via the `--next` flag, which zips and uploads all maps as a single file. While the old method is still supported, `--next` might offer benefits for large projects.
fix
For new projects or existing ones with many source maps, consider using the `--next` flag with `upload-sourcemaps`. Test both methods to see which performs better for your build process.
affects: >=0.2.0
gotchaSecurity warning in `axios` dependency for versions prior to `0.2.1` of `rollbar-cli`. While an internal dependency, it's always best to be on the latest version to ensure all components are secure.
fix
Upgrade to `rollbar-cli` version `0.2.1` or higher to ensure the patched `axios` version is in use: `npm install -g rollbar-cli@latest`.
affects: <0.2.1
Errors
Common errors & fixes
Error: Missing required option: --access-token
A mandatory command-line option, such as `--access-token`, `--url-prefix`, `--code-version`, or `--environment`, was omitted from the command.
fix
Review the command's requirements and add the missing option with its corresponding value. For example, `rollbar-cli upload-sourcemaps ... --access-token YOUR_TOKEN`.
Error: path argument is required
The `upload-sourcemaps` command was invoked without specifying the required path to the build directory containing your JavaScript and source map files.
fix
Provide the absolute or relative path to your build output directory as the first argument to the command. Example: `rollbar-cli upload-sourcemaps ./dist ...`.
command not found: rollbar-cli
The `rollbar-cli` executable is not found in your system's PATH. This usually means it was not installed globally or the global npm bin directory is not configured correctly.
fix
Install the package globally using `npm install -g rollbar-cli`. If already installed, ensure your system's PATH includes the directory where global npm binaries are stored.
(node:...) UnhandledPromiseRejectionWarning: Error: Bad Access Token (or similar API error indicating authentication failure)
The provided `--access-token` is either incorrect, expired, or does not have the necessary permissions (e.g., `post_server_item` scope) to perform the requested operation on the Rollbar API.
fix
Verify that the `--access-token` is correct and active in your Rollbar project settings. Ensure it is a 'post_server_item' token and has the required read/write permissions for source maps and deployments.
Upgrade
Version history
0.2.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
26 hits · last 30 days
node
22
OpenAI (training)
2
Amazon
1
Resources
rollbar-cli — npm install rollbar-cli · libregistry