{"id":12920,"library":"bugsnag-build-reporter","title":"Bugsnag Build Reporter","description":"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.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/bugsnag/bugsnag-build-reporter-node","tags":["javascript","bugsnag","build","report","ci","cli"],"install":[{"cmd":"npm install bugsnag-build-reporter","lang":"bash","label":"npm"},{"cmd":"yarn add bugsnag-build-reporter","lang":"bash","label":"yarn"},{"cmd":"pnpm add bugsnag-build-reporter","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"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`.","wrong":"import reportBuild from 'bugsnag-build-reporter'","symbol":"reportBuild","correct":"const reportBuild = require('bugsnag-build-reporter')"},{"note":"While primarily CJS, modern Node.js environments might support dynamic `import()` or direct ESM `import` for CJS modules. Stick to `require` for broad compatibility.","wrong":"const reportBuild = require('bugsnag-build-reporter')","symbol":"reportBuild","correct":"import reportBuild from 'bugsnag-build-reporter'"},{"note":"When using the CLI locally without a global install, `npx` is recommended. Ensure flags are correctly passed.","wrong":"bugsnag-build-reporter --apiKey='YOUR_API_KEY' --appVersion='1.2.3'","symbol":"CLI Usage","correct":"npx bugsnag-build-reporter --apiKey='YOUR_API_KEY' --appVersion='1.2.3'"}],"quickstart":{"code":"const reportBuild = require('bugsnag-build-reporter')\n\nconst BUGSNAG_API_KEY = process.env.BUGSNAG_API_KEY ?? ''\nconst APP_VERSION = process.env.APP_VERSION ?? '1.0.0'\n\nif (!BUGSNAG_API_KEY) {\n  console.error('BUGSNAG_API_KEY environment variable is not set.')\n  process.exit(1)\n}\n\nreportBuild(\n  { \n    apiKey: BUGSNAG_API_KEY,\n    appVersion: APP_VERSION,\n    releaseStage: 'production',\n    builderName: 'CI/CD Pipeline'\n  },\n  { \n    logLevel: 'info' \n  }\n)\n  .then(() => console.log('Bugsnag build report sent successfully!'))\n  .catch(err => {\n    console.error('Failed to send Bugsnag build report:', err.message)\n    process.exit(1)\n  })\n","lang":"javascript","description":"This script demonstrates reporting a build to Bugsnag using the JS API, including required parameters and basic error handling."},"warnings":[{"fix":"Upgrade your Node.js runtime to version 8 or newer before upgrading to bugsnag-build-reporter v2.0.0.","message":"Version 2.0.0 dropped support for Node.js 6. Ensure your build environment uses Node.js 8 or higher to avoid compatibility issues.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Always provide `apiKey` and `appVersion` in the build configuration object or as CLI arguments. Example: `{ apiKey: 'YOUR_API_KEY', appVersion: '1.2.3' }`.","message":"The `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.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Manually specify the `sourceControl` object in your build configuration: `{ sourceControl: { provider: 'github', repository: 'https://github.com/org/repo', revision: 'SHA' } }`.","message":"Automatic 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"Older 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.","severity":"gotcha","affected_versions":"<2.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure the `apiKey` property is set in the build object: `reportBuild({ apiKey: 'YOUR_API_KEY', appVersion: '...' })`.","cause":"The Bugsnag API key was not provided in the build configuration.","error":"Error: build.apiKey is required"},{"fix":"Ensure the `appVersion` property is set in the build object: `reportBuild({ apiKey: '...', appVersion: '1.2.3' })`.","cause":"The application version was not provided in the build configuration.","error":"Error: build.appVersion is required"},{"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`.","cause":"The CLI tool is not globally installed or not found in the PATH, or `npx` was not used for local execution.","error":"bugsnag-build-reporter: command not found"},{"fix":"Verify that your `apiKey` is correct and has the necessary permissions in your Bugsnag project settings.","cause":"The provided Bugsnag API key is invalid or unauthorized.","error":"Failed to report build: Request failed with status code 401"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"bugsnag-build-reporter"}