To send React Native source map files to Bugsnag, simply POST them to
https://upload.bugsnag.com/react-native-source-map with the following parameters:
apiKey- the Bugsnag API key that is used in your app.
appVersion(optional) - the appVersion of the application.
appVersionCode(optional) - the versionCode for the application. (Android only)
appBundleVersion(optional) - the bundle version for the application. (iOS only)
codeBundleId(optional) - the codeBundleId if using App Center CodePush.
dev(optional) - indicates whether the application is a debug or release build. This value should mirror the value used when generating source map files with
react-native bundle. (default:
platform- the application platform, either
sourceMap- the path to the source map file.
bundle- the path to the bundle file.
projectRoot(optional) - the root path of the project on the filesystem where the source map was built. This will be stripped off from the file name in the displayed stacktraces and improves error grouping for errors reported from the same location within the app but with a different project root.
overwrite(optional) - denotes whether to overwrite an existing source map for the specified
platformand version combination. (default:
If using App Center CodePush only the
codeBundleId should be provided. Otherwise, at least one of
appBundleVersion is required. See Selecting an app version for guidance.
Please note that errors that were received before the source maps were uploaded will not be retrospectively de-obfuscated.
Here’s an example request with cURL, where the ’@’ sign indicates that the
bundle parameters are uploaded files:
$ curl https://upload.bugsnag.com/react-native-source-map \ -F apiKey=YOUR_API_KEY_HERE \ -F appVersion=1.2.3 \ -F dev=true \ -F platform=android \ -F sourceMap=@path/to/example.jsbundle.map \ -F bundle=@path/to/example.jsbundle \ -F projectRoot=/path/to/project/
If the files are accepted then an HTTP 200 response will be returned with the body “OK”. If not, there are several possible problems which will be indicated with an HTTP 4XX response:
apiKeydoesn’t correspond to a Bugsnag project.
If the uploaded source map is not being applied correctly, you should verify that:
codeBundleIduploaded with the source map matches that of the app generating the error (if using App Center CodePush) or
appBundleVersionuploaded with the source map matches that of the app generating the error
platformuploaded with the source map matches that of the app generating the error
devflag uploaded with the source map matches the value used when generating source map files with
Once a source map is uploaded it will only get applied to new error events. It does not get applied retroactively to existing errors events.
If the stacktrace has been mapped but is pointing to the wrong line of code, it’s often due to the wrong bundle/source map file being uploaded for the file in the reported stacktrace.
See Generating source maps for guidance of how to generate the correct source map for the build variant.