Overview
This module is for publishing source maps to New Relic Browser. It can be used from the command line or programatically from a node script.
Published source maps are used to automatically unminify stack traces for JavaScript errors in the New Relic Browser Monitoring product.
Please see the source map documentation for more details.
Command Line
Install
In order to publish source maps from the command line, install the library globally.
npm install -g newrelic-publish-sourcemap
Usage
Options can be provided on the command line or as environment variables.
publish-sourcemap [dist/sourcefile.js.map] [http://example.com/assets/sourcefile.js] --applicationId=[ID] --nrAdminKey=[apiKey]
Options:
--applicationId Browser application id (APPLICATION_ID)
--nrAdminKey New Relic admin api key (NR_ADMIN_KEY)
--releaseName [Optional] unique identifer for the release name
(RELEASE_NAME)
--releaseId [Optional] unique version for the release identifier
(RELEASE_ID)
From javascript
Install
The module can also be used from a JavaScript build tool such as gulp.
npm install --save-dev newrelic-publish-sourcemap
var publishSourcemap = require(‘newrelic-publish-sourcemap’)
publishSourcemap({
sourcemapPath: ‘./dist/bundle.js.map’,
javascriptUrl: 'https://example.com/assets/bundle.js',
applicationId: 1234,
nrAdminKey: 'APIKEY',
}, function (err) { console.log(err || 'Sourcemap upload done')})