Reporting Source Maps
Honeybadger can automatically un-minify your JavaScript code if you provide a source map along with your minified files. Use the Source Map Upload API to upload your source maps to Honeybadger. See Using Source Maps to learn more.
Overview
To upload your source map files to Honeybadger, POST them to https://api.honeybadger.io/v1/source_maps
with the following parameters:
Param | Required | Description |
---|---|---|
api_key | Required | The API key of your Honeybadger project (see the API Key tab in project settings). |
minified_url | Required | The URL of your minified JavaScript file in production. * can be used as a wildcard. Must be an absolute URL (query strings are ignored). |
minified_file | Required | The minified file itself. |
source_map | Required | The source map for your minified file. |
revision | Optional, default: master
|
The deploy revision (i.e. commit sha) that your source map applies to. This could also be a code version. For best results, set it to something unique every time your code changes. The revision option must also be configured in honeybadger.js. |
<additional source files> | Optional | One or more additional source files which may be referenced by your source map. The name should be the URL that would normally be used to access the file, and the value should be the file itself. Many source map generators include the sources in the sourcesContent key inside the source map, so you may not need to send these. * in the name can be used as a wildcard. |
Here's an example using curl
:
curl https://api.honeybadger.io/v1/source_maps \
-F api_key=Your project API key \
-F revision=dcc69529edf375c72df39b0e9195d60d59db18ff \
-F minified_url=https://example.com/assets/application.min.js \
-F source_map=@path/to/application.js.map \
-F minified_file=@path/to/application.min.js \
-F http://example.com/assets/application.js=@path/to/application.js \
-F http://example.com/assets/utils.js=@path/to/utils.js
Response Codes
The /v1/source_maps
API endpoint responds with the following codes:
Code | Status | Description |
---|---|---|
201 | Created | The files were uploaded successfully. |
400 | Bad Request | You're missing a required parameter or have exceeded the maximum file size of 80MB per file (check the error message). |
401 | Unauthorized | Your API key is invalid. |
Wildcards
In some cases you may want to upload the same source map for different URLs—for instance, if you serve your files from multiple subdomains, or via both HTTP and HTTPS.
An asterisk (*
) can be used in URLs to perform a wildcard match. For example, the following example will match both the http://
and https://
version of the URL:
http*://example.com/assets/application.min.js
...matches the following URLs:
http://example.com/assets/application.min.js
https://example.com/assets/application.min.js
Wildcards are not supported in file names:
// invalid (will be an exact match):
https://example.com/assets/*.min.js