MindscapeHQ / raygun4reactnative

ReactNative crash reporting SDK for Raygun
MIT License
3 stars 3 forks source link

React Native Sourcemaps #51

Open adrianheng-seekasia opened 2 years ago

adrianheng-seekasia commented 2 years ago

Heya there,

We're trying to make sure use of this package, but are running into issues with getting sourcemaps up and running.

We've tried to upload sourcemaps following the general advice from https://raygun.com/documentation/product-guides/crash-reporting/sourcemaps/#using-private-source-maps-for-hybrid-mobile-apps, but have found that they do not appear to map errors to these sourcemaps when we check on the Raygun crash dashboard.

Wondering if anybody could shed some light on this, or point us to a resource (e.g: documentation, guide, etc) to help us resolve this?

Relevant packages used:

react-native: 0.66.3, raygun4reactnative: 1.1.5

Widdershin commented 2 years ago

Hi @adrianheng-seekasia,

It's possible that this is occuring as a result of the source maps containing absolute paths to each code file, rather than relative.

Unfortunately, this is the default behaviour when generating source maps using React Native. In order to generate source maps that correctly use relative paths, the --sourcemap-sources-root argument must be set to the project root when bundling the application.

This StackOverflow post details the process of setting --sourcemap-sources-root for both Android and iOS projects: https://stackoverflow.com/questions/36879005/react-native-building-a-reliable-source-map/50067581#50067581

You can verify this is the problem by opening a generated source map and inspecting the paths. If they contain absolute path information from the system they were generated on, --sourcemap-sources-root will need to be applied.