Skip to content

React-Native: Sourcemaps not working for JS errors in Android app #873

Closed

Description

@varungupta85

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

The crash reports are not mapped to actual code location for JS errors happening in Android app

What is the expected behavior?

The crash report should show the actual line of code where the error happened. This is working as expected for the iOS app but not for the Android app. I have uploaded the bundle and the map files for both the OSes to Sentry. The bundle and the sourcemaps for Android are generated using the following command:

react-native bundle --dev false --platform android --entry-file index.android.js --bundle-output index.android.bundle --sourcemap-output index.android.map

Below is the screenshot of the bundle and the map file present on Sentry

screen shot 2017-03-01 at 11 22 19 am

Below is a screenshot of the how the crash report is shown on Sentry

screen shot 2017-03-01 at 11 23 45 am

As seen, the error is not mapped to the actual source file.

On iOS, the same error is mapped to the correct source file.

Which versions of Raven.js, and which browser and OS are affected by this issue? Did this work in previous versions of Raven.js? Are you using the CDN (http://ravenjs.com)? Are you using hosted Sentry or on-premises? If on-premises, which version (e.g. 8.7.0)?

raven-js: 3.7.0 installed via npm
It has not worked on Android for me.
Hosted Sentry

Activity

  1. varungupta85 commented on Mar 1, 2017

    @varungupta85
    Author

    Just realized that there are some extra troubleshooting steps added to debug problems related to sourcemaps. I tried to verify the sourcemap locally using the steps mentioned. Using the above stack trace, I used line number as 164234 and column as 7766. I got { source: null, line: null, column: null, name: null } as response. When I use line number as 1 and column as 7766, then I get

    { source: '/Users/abc/Projects/GalarmApp/node_modules/react-native/packager/react-packager/src/Resolver/polyfills/prelude.js',
      line: 4,
      column: 36,
      name: 'now' }

    as the response which is also not the correct source location.

    I have verified tha the `sourceMappingURL is present in the bundle file.

  2. varungupta85 commented on Mar 1, 2017

    @varungupta85
    Author

    Some more investigation notes, I tried the same test with iOS sourcemap. I tried to decode an error at main.jsbundle:682:12831. So, I used the line number as 682 and the column number as 12831 and it resolved to the correct code location.

    So, is with the reported line number and the column number in the Android error?

    Would this be a problem with react-native in that case?

  3. benvinegar commented on Mar 1, 2017

    @benvinegar
    Contributor

    Would this be a problem with react-native in that case?

    If you're using source-map and got that result, seems so. I'd open an issue on the react-native project. If you could put together a minimal example for them, they'd probably act on it quickly.

  4. atticoos commented on Mar 2, 2017

    @atticoos

    I'm having a similar issue with source maps within a React Native project on Sentry.

    Source code not found errors

    Each report comes with this warning:

    screen shot 2017-03-02 at 12 07 41 pm

    "Original" stack trace

    screen shot 2017-03-02 at 12 07 07 pm

    "Minified" stack trace

    As you can see, they're expandable, so the sourcemap appears to be working

    screen shot 2017-03-02 at 12 07 35 pm

    And there certainly are artifacts for the release

    screen shot 2017-03-02 at 12 11 45 pm

  5. atticoos commented on Mar 2, 2017

    @atticoos

    Seems potentially related to getsentry/sentry#3224, via getsentry/sentry#3976?

  6. misterecco commented on Apr 18, 2017

    @misterecco

    @ajwhite If you still get Source code not found errors you can try using --rewrite option when uploading source map with sentry-cli

  7. HazAT commented on May 10, 2017

    @HazAT
    Member

    Hey,
    Check out our official client for react-native -> https://github.com/getsentry/react-native-sentry

    This now has native android support and a gradle built step which builds and uploads sourcemaps.
    I am closing this since this is mainly react-native related if the issues persist create an issue in the other repo please.

    Thank you

  8. added a commit that references this issue on Jun 19, 2026
    79d3f9e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions