Node.js and Electron source maps

Using our source map library you can upload source maps to unminify stack traces and get human-readable method names, files, and line numbers.


@bugsnag/source-maps provides a CLI and a JavaScript library that can be used to upload your application’s source maps.

Install it globally on your system:

npm install --global @bugsnag/source-maps
# or
yarn global add @bugsnag/source-maps

Or locally inside your project:

npm install --save-dev @bugsnag/source-maps
# or
yarn add --dev @bugsnag/source-maps


The library can be used via the command line:

bugsnag-source-maps upload-node <opts>

Or as a JavaScript API:

const { node } = require('@bugsnag/source-maps')

interface node  {
  async function uploadOne (UploadSingleOpts): Promise<void>
  async function uploadMultiple (UploadMultipleOpts): Promise<void>


To apply source maps for Electron apps, upload your main and renderer bundles using the Node.js options.

If you publish renderer JS updates without releasing a new version of your app, use the codeBundleId option to identify the bundle to BugSnag for matching source maps. This should be set to a matching value in notifier configuration.

If you’re using Electron Forge with the Webpack plugin you can use BugSnag’s Webpack plugin. See the Webpack integration docs.


You can upload a single source map and bundle pair:

bugsnag-source-maps upload-node \
  --api-key YOUR_API_KEY_HERE \
  --app-version 1.2.3 \
  --source-map dist/ \
  --bundle dist/index.js

Or when your build doesn’t combine the output into a single bundle, but creates a generated file and source map for every input file (for instance, the Babel or TypeScript compiler when not used in conjunction with a bundler) use the directory mode:

bugsnag-source-maps upload-node \
  --api-key YOUR_API_KEY_HERE \
  --app-version 1.2.3 \
  --directory dist

Option reference

The full set of options for @bugsnag/source-maps.

Property (CLI, JS API) Type Description
string your project’s API key [required]
string the version of the application you are building (this should match the appVersion configured in your notifier).
boolean detect the app version from the package.json file
string (Electron only) uniquely identify the bundle if published separately to your app
string customize the endpoint for BugSnag On-Premise
number idle timeout for HTTP requests in minutes (see the Node request.setTimeout docs)
(JS only)
Object provide a custom logger (must match the internal Logger interface)
boolean whether to replace existing source maps uploaded with the same version
string the top level directory of your project
(JS only)
RequestOptions supply options that should be passed to http.request(), for example if you need to provide an agent to send via a proxy
--quiet (CLI only) boolean less verbose logging
Singe upload options
string the path to the source map [required]
string the path to the bundle [required]
Multiple upload options
string the directory to start searching for source maps in, relative to the project root [required]