Node.js 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 @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>


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 customize the endpoint for Bugsnag On-Premise
(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]