Registry / devops / bugsnag-build-reporter

bugsnag-build-reporter

JSON →
library2.0.0jsnpmunverified

bugsnag-build-reporter is a utility designed for reporting application build information to Bugsnag. Currently at version 2.0.0, this package provides both a JavaScript API for integration into custom Node.js build environments and a command-line interface (CLI) for use in npm scripts or CI/CD pipelines. It differentiates itself by offering automatic detection of source control information (from .git, .hg, or package.json) and allowing builds to be associated with specific release stages. While Bugsnag provides higher-level integrations for Webpack, Gulp, and Grunt, this reporter is ideal for bespoke build systems or command-line driven workflows, ensuring comprehensive error monitoring setup across diverse development practices. The release cadence appears to be driven by dependency updates and minor feature enhancements.

npm install bugsnag-build-reporter
INSTALL
IMPORT
SIG · BUGSNAG-BUILD-REPO
B
bugsnag-build-reporter
devopsjavascriptv2.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

reportBuild
const reportBuild = require('bugsnag-build-reporter')
import reportBuild from 'bugsnag-build-reporter'
Primary usage is CommonJS `require` for Node.js environments. The package is not explicitly an ESM module, though it may be importable in modern Node.js via `import`.
reportBuild
import reportBuild from 'bugsnag-build-reporter'
const reportBuild = require('bugsnag-build-reporter')
While primarily CJS, modern Node.js environments might support dynamic `import()` or direct ESM `import` for CJS modules. Stick to `require` for broad compatibility.
CLI Usage
npx bugsnag-build-reporter --apiKey='YOUR_API_KEY' --appVersion='1.2.3'
bugsnag-build-reporter --apiKey='YOUR_API_KEY' --appVersion='1.2.3'
When using the CLI locally without a global install, `npx` is recommended. Ensure flags are correctly passed.

This script demonstrates reporting a build to Bugsnag using the JS API, including required parameters and basic error handling.

const reportBuild = require('bugsnag-build-reporter') const BUGSNAG_API_KEY = process.env.BUGSNAG_API_KEY ?? '' const APP_VERSION = process.env.APP_VERSION ?? '1.0.0' if (!BUGSNAG_API_KEY) { console.error('BUGSNAG_API_KEY environment variable is not set.') process.exit(1) } reportBuild( { apiKey: BUGSNAG_API_KEY, appVersion: APP_VERSION, releaseStage: 'production', builderName: 'CI/CD Pipeline' }, { logLevel: 'info' } ) .then(() => console.log('Bugsnag build report sent successfully!')) .catch(err => { console.error('Failed to send Bugsnag build report:', err.message) process.exit(1) })
bugsnag-build-reporter --version
Debug
Known issues
breakingVersion 2.0.0 dropped support for Node.js 6. Ensure your build environment uses Node.js 8 or higher to avoid compatibility issues.
fix
Upgrade your Node.js runtime to version 8 or newer before upgrading to bugsnag-build-reporter v2.0.0.
affects: >=2.0.0
gotchaThe `apiKey` and `appVersion` properties are strictly required in the build object when using the JS API or CLI. Omitting them will cause the report to fail.
fix
Always provide `apiKey` and `appVersion` in the build configuration object or as CLI arguments. Example: `{ apiKey: 'YOUR_API_KEY', appVersion: '1.2.3' }`.
affects: >=1.0.0
gotchaAutomatic source control detection relies on the presence of `.git`, `.hg` directories or `package.json`. In non-standard or stripped build environments, this might fail. Explicitly provide `sourceControl` details if detection is unreliable.
fix
Manually specify the `sourceControl` object in your build configuration: `{ sourceControl: { provider: 'github', repository: 'https://github.com/org/repo', revision: 'SHA' } }`.
affects: >=1.0.0
gotchaOlder versions of `bugsnag-build-reporter` might have depended on vulnerable versions of `meow`. Always ensure you are on the latest major version (2.x) to benefit from dependency security updates.
fix
Update to the latest `bugsnag-build-reporter@2.x.x` using `npm install bugsnag-build-reporter@latest` to ensure all transitive dependencies are up-to-date.
affects: <2.0.0
Errors
Common errors & fixes
Error: build.apiKey is required
The Bugsnag API key was not provided in the build configuration.
fix
Ensure the `apiKey` property is set in the build object: `reportBuild({ apiKey: 'YOUR_API_KEY', appVersion: '...' })`.
Error: build.appVersion is required
The application version was not provided in the build configuration.
fix
Ensure the `appVersion` property is set in the build object: `reportBuild({ apiKey: '...', appVersion: '1.2.3' })`.
bugsnag-build-reporter: command not found
The CLI tool is not globally installed or not found in the PATH, or `npx` was not used for local execution.
fix
If installed locally, run with `npx bugsnag-build-reporter ...` or add `$(npm bin)` to your PATH. For global access, install via `npm install -g bugsnag-build-reporter`.
Failed to report build: Request failed with status code 401
The provided Bugsnag API key is invalid or unauthorized.
fix
Verify that your `apiKey` is correct and has the necessary permissions in your Bugsnag project settings.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
bugsnag-build-reporter — npm install bugsnag-build-reporter · libregistry