Zero-dependency Node library to upload source maps to Sentry
yarn add sentry-files --dev
import path from 'path';
const { upload } = require('sentry-files');
const config = {
version: '1.0.0',
organization: 'example-organization',
project: 'example-project',
token: 'YOUR_API_TOKEN_HERE',
files: [
{
name: 'http://example.com/assets/main.js.map',
path: path.resolve(__dirname, 'path/to/main.js.map'),
},
],
};
upload(config)
.then(data => console.log('----- SUCCESS ----\n', data))
.catch(error => console.log('---- ERROR ----\n', error));
For an example uploading source maps of a React app check this post.
Type: function
Returns: Promise
It creates a release and uploads the files to that release.
Type: Object
Required
An object specifying the options used to create the release and upload the files.
Type: String
Required
Version used to create the release.
Type: String
Required
Sentry organization name.
Type: String
Required
Sentry project name.
Type: String
Required
Authentication token required to perform actions against the Sentry API.
Ensure you have project:write
selected under scopes.
Type: Array
Required
Array of objects describing the files to upload to Sentry.
[
{
name: 'Sentry file name',
path: 'Local file path'
},
{
name: '...',
path: '...'
}
…]
Type: String
Required
Name of the file on Sentry.
More about Sentry file names: Upload a New File, Uploading Source Maps to Sentry and Assets Accessible at Multiple Origins
Type: String
Required
Path to the file locally.