Option A: Automatic source maps download
If your source map is publicly web-accessible, we can download it automatically. Atatus requires the following to complete the decode process:- There must be a stack trace.
- The minified JavaScript files as specified in the stack trace, must be publicly accessible.
-
The map file is to be correctly indicated in the minified JavaScript file using a footer comment. As specified in the Source Map Specification, following comment should be at the bottom of your minified JavaScript files:
- The source map file itself must be publicly accessible.
sourceMappingUrl comment. If it has one, we’ll try to download that file and cache it as the source map. Then for future errors, we’ll use the source map to translate the minified frames back to original frames.
Option B: Uploading source maps
If you do not want to expose your source map or code to the public web, you can upload them directly to Atatus. At the beginning of your deploy script (before the new code is in production), you can upload a source map via our API.Sample
Parameters
Version number is only necessary if the script filename (url) is the same across all deployments.
If you have set a version number in source map, you must also set the version in Atatus snippet and vice versa.
atatus.setVersion('version_string_here')Response Codes
The source map is stored as
project + minified URL + version. Uploading it more than once will lead to writing over the previous data.
Delete Source Maps
You can use the delete API to delete all older source maps or specific versions of source maps or source maps from specific days.Parameters
You have to specify one of the below mentioned parameters but, you can only specify one parameter at a time.Source Maps for Hybrid Mobile Apps
In hybrid mobile applications, such as Ionic, PhoneGap, Apache Cordova etc., you might find the error stack traces containing file paths which are different across platforms and devices. This creates complexity when trying to use source maps, because source map requires the minifed URL that is used during upload matches with the URL that would appear in a stack trace. For this reason we recommend adding a handler to rewrite file’s URLs before the error is reported back to Atatus. An example of such a handler is shown below:http://mywebsite.com/)
When you should use version number
Some prefer to have same script file name across all deployments. An example would be, if you decide to have your JavaScript file ashttps://www.acme.com/scripts/main.js
In this case, source map could end up being different for every deployment, depending upon the changes in your main.js file. In order to differentiate these files, you have to set version number in your script side as well as when you upload the source map.
There would be cases where you change your script file name every time you build it, using a version number(random) in the name of the file(example, https://www.acme.com/scripts/main-4ef53.js). By doing so, every deploy will have a unique script file name. So you do not need to set version number at your script side. Therefore, when you upload the source map too, you should not set the version number.
Please note that, if you do not set a version number in your script but upload a source map with a version number set, then source map will not work. Please keep this in mind.