Sentry-react-native: Invalid location in sourcemap, android, hermes, codepush

Created on 25 May 2020  路  10Comments  路  Source: getsentry/sentry-react-native

OS:

  • [ ] Windows
  • [*] MacOS
  • [ ] Linux

Platform:

  • [ ] iOS
  • [*] Android

SDK:

  • [*] @sentry/react-native (>= 1.0.0)
  • [ ] react-native-sentry (<= 0.43.2)

SDK version: 1.3.9

react-native version: 0.62.2

Are you using Expo?

  • [ ] Yes
  • [* ] No

Are you using sentry.io or on-premise?

  • [*] sentry.io (SaaS)
  • [ ] on-premise

If you are using sentry.io, please post a link to your issue so we can take a look:

https://sentry.io/organizations/rarira-studio/issues/1687283387/?project=1868470&query=is%3Aunresolved

Configuration:

(@sentry/react-native)

if (!__DEV__) {
  Sentry.init({
    dsn: SENTRY_DSN,
    ignoreErrors: ['No current user', 'not authenticated'],
    debug: true,
    beforeSend: e => {
      if (!e.tags) {
        e.tags = {};
      }
      e.tags['beforeSend'] = 'JS layer';
      return e;
    },
    enableAutoSessionTracking: true,
  });
  Sentry.setRelease(BUNDLE_ID + '@' + VERSION + '+' + BUILD_NUMBER);
  Sentry.setDist(BUILD_NUMBER);
}

      codePush
        .getUpdateMetadata()
        .then(update => {
          if (update) {
            Sentry.setRelease(BUNDLE_ID + '-' + update.appVersion + '-codepush:' + update.label);
          }
        })
        .catch(err => {
          Sentry.setRelease(BUNDLE_ID + '@' + VERSION + '+' + BUILD_NUMBER);
        });

I have following issue:
There is no issue with IOS and android with no codepush update
but when with codepush updated,
There are 3 artifacts uploaded with the release,
but the size of index.android.bundle is 0B

Actual result:

and have error
Invalid location in sourcemap
app:///index.android.bundle

Expected result:

[Expected result]

code-push

Most helpful comment

The above-mentioned fixes worked for me! :)

Basically, in my CodePush release script, between the step that does appcenter codepush release-react and the step that does sentry-cli react-native appcenter, I added these commands:

# rename incomplete JavaScript bundle map (missing Hermes data) to .intermediate.map
mv build/CodePush/index.android.bundle.map build/CodePush/index.android.bundle.intermediate.map

# run compose-source-maps.js to merge the incomplete intermediate map with the Hermes map
# to create a final, complete bundle map for Sentry
node node_modules/react-native/scripts/compose-source-maps.js build/CodePush/index.android.bundle.intermediate.map build/CodePush/index.android.bundle.hbc.map -o build/CodePush/index.android.bundle.map

All 10 comments

Also seeing this, just updated to @sentry/react-native 1.4.1 hoping to resolve but still having a 0b index.android.bundle

image

image

Issue link:

https://sentry.io/organizations/nerd-fitness/issues/1658003868/?project=1724512&query=is%3Aunresolved

@jennmueng would you mind testing this with the latest version when you have some free time? I don't have much experience with code push

@jennmueng would you mind testing this with the latest version when you have some free time? I don't have much experience with code push

I tried with the latest version 1.6.1 but failed with different result
https://sentry.io/share/issue/d155f7425d194f948f7f2ceb08d5da10/

I am also having this issue on latest version.
sentry-cli: 1.55.1
@sentry/react-native : "^1.7.1"

Are there any updates?

@rarira @shangyilim-hubble Can you try out the fixes mentioned here: https://github.com/getsentry/sentry-react-native/issues/761#issuecomment-587498344 and see if that works?

The above-mentioned fixes worked for me! :)

Basically, in my CodePush release script, between the step that does appcenter codepush release-react and the step that does sentry-cli react-native appcenter, I added these commands:

# rename incomplete JavaScript bundle map (missing Hermes data) to .intermediate.map
mv build/CodePush/index.android.bundle.map build/CodePush/index.android.bundle.intermediate.map

# run compose-source-maps.js to merge the incomplete intermediate map with the Hermes map
# to create a final, complete bundle map for Sentry
node node_modules/react-native/scripts/compose-source-maps.js build/CodePush/index.android.bundle.intermediate.map build/CodePush/index.android.bundle.hbc.map -o build/CodePush/index.android.bundle.map

The above-mentioned fixes worked for me! :)

Basically, in my CodePush release script, between the appcenter codepush release-react step and the sentry-cli react-native appcenter step, I added these commands:

# rename incomplete JavaScript bundle map to .intermediate.map
mv build/CodePush/index.android.bundle.map build/CodePush/index.android.bundle.intermediate.map
# run compose-source-maps.s to merge the incomplete intermediate map with the Hermes map
node node_modules/react-native/scripts/compose-source-maps.js build/CodePush/index.android.bundle.intermediate.map build/CodePush/index.android.bundle.hbc.map -o build/CodePush/index.android.bundle.map

@jennmueng @danmaas it works as expected

Looks like we can close this then, we'll look into adding this to the official documentation

Hi @ahartzog Have you resolved the issue with 0B index.android.bundle ?
I have the same

Just an update, as of appcenter-cli version 2.10.0 and later, AppCenter now takes care of running compose-source-maps. So the work-around in my comment above is no longer necessary.

Was this page helpful?
0 / 5 - 0 ratings