The JavaScript code in your app is minified in a release build and so is not visible in the stacktraces of errors from your users devices. Uploading source maps enables you to see the original method names, file paths, and line numbers in stacktraces.
It is also necessary to upload symbol files for any Turbo Module C or C++ code that is included in your app.
To send React Native source map files to BugSnag, you can use the BugSnag CLI. To do this, run the following command from the root of your project:
$ bugsnag-cli upload react-native-sourcemaps \
--api-key=YOUR_API_KEY
--platform=vega
--bundle=build/lib/rn-bundles/Release/index.bundle \
--source-map=build/lib/rn-bundles/Release/index.bundle.map \
--version-name=1.2.3
--version-code=4.5.6
For more information on uploading source maps see the React Native source map upload API reference.
Symbol files for C or C++ code from Turbo Modules can be found in:
<turbomodule>/build/<arch>/lib/<turbomodule>.so.debug
Debug symbols for C files are not added by default in Vega builds. To enable debug symbols add the following to your module’s CMakeLists.txt file:
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
To send these shared object files containing symbols to BugSnag using the BugSnag CLI, run the following command from the root of your project:
$ bugsnag-cli upload linux \
--api-key=YOUR_API_KEY \
--version-name=1.2.3 \
--application-id=com.example.app \
my_native_module/build/<arch>/lib/my_native_module.so.debug
For more information on uploading symbol files see the NDK upload endpoint.