sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

Stack frame path doesn't match a source file artifact name

Open ShaneMcNamara opened this issue 1 year ago • 2 comments

OS:

  • [ ] Windows
  • [x] MacOS
  • [ ] Linux

Platform:

  • [x] iOS
  • [ ] Android

SDK:

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

SDK version: "@sentry/react-native": "5.10.0",

react-native version: "react-native": "0.72.6",

Are you using Expo?

  • [x] Yes
  • [ ] No

Are you using sentry.io or on-premise?

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

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

[Link to issue]

Configuration:

(@sentry/react-native)

Sentry.init({
  dsn: config.sentryDSN,
  environment: config.env,
  enableInExpoDevelopment: config.enableInExpoDevelopment,
  release: `mobile@${version}`,
  dist: commit,
  integrations: [
    new RewriteFrames({
      iteratee: frame => {
        if (frame.filename) {
          // the values depend on what names you give the bundle files you are uploading to Sentry
          frame.filename =
            Platform.OS === 'android' ? 'app:///index.android.bundle' : 'app:///main.jsbundle';
        }
        return frame;
      },
    }),
  ],
  debug: config.env === 'local'
});

I have the following issue:

We receive a warning that the stack frame path does not match a source file artifact name, and our stack trace is not useful.

Screenshot 2024-03-07 at 4 29 07 PM

yet the artifact is there

Screenshot 2024-03-07 at 4 29 52 PM

There was a similar issue reported here: https://github.com/getsentry/sentry-react-native/issues/3492 but in that instance they were not setting dist, we however are setting dist. I'm not sure if the fact that the minified files are 0 bytes matter or not.

ShaneMcNamara avatar Mar 08 '24 00:03 ShaneMcNamara

Hi @ShaneMcNamara, thank you for the message, you are correct the dist is correct, but the bundle ~/main.jsbundle doesn't reference the ~/ios-df3a612bfd09bd56f8d2a7349f9cdfac.map source map file.

The referencing is done during the upload of the source maps, can you share how you upload the source maps and output of that command?

The reference is displayed in Sentry like this: Screenshot 2024-03-12 at 13 03 34

PS: Since https://github.com/getsentry/sentry-react-native/releases/tag/5.16.0 and Expo SDK 50 we offer a new way of uploading source maps.

krystofwoldrich avatar Mar 12 '24 12:03 krystofwoldrich

Hi @krystofwoldrich,

Thanks for the response

We've essentially followed the guide here: https://docs.expo.dev/guides/using-sentry/#uploading-source-maps-for-updates for SDK 49 and below.

In the deploy step of our pipeline we run these commands:

 - eas update --channel $CHANNEL --message=$BITBUCKET_COMMIT
 # https://docs.expo.dev/guides/using-sentry/
- mv dist/bundles/android-*.hbc dist/bundles/index.android.bundle
- mv dist/bundles/ios-*.hbc dist/bundles/main.jsbundle
- node_modules/@sentry/cli/bin/sentry-cli releases files mobile@$RELEASE upload-sourcemaps --dist $BITBUCKET_COMMIT --rewrite dist/bundles/*  \;

The releases command gives this output:

node_modules/@sentry/cli/bin/sentry-cli releases files mobile@$RELEASE upload-sourcemaps --dist $BITBUCKET_COMMIT --rewrite dist/bundles/* \;
> Found 1 file
> Found 1 file
> Found 1 file
> Found 1 file
> Analyzing 4 sources
> Rewriting sources
> Adding source map references
> Bundled 4 files for upload
> Bundle ID: e6c5533b-d942-5cb6-8ef0-905ba89443b0
> Uploaded files to Sentry
> File upload complete (processing pending on server)
> Organization: ontraccr
> Project: mobile
> Release: [email protected]
> Dist: 80ca67d291239b31995d5f5f6dca535cb7a7411f
> Upload type: artifact bundle
Source Map Upload Report
  Minified Scripts
    ~/index.android.bundle (no sourcemap ref)
      - warning: could not determine a source map reference (Could not auto-detect referenced sourcemap for ~/index.android.bundle)
    ~/main.jsbundle (no sourcemap ref)
      - warning: could not determine a source map reference (Could not auto-detect referenced sourcemap for ~/main.jsbundle)
  Source Maps
    ~/android-f2f493293172275f74952f6b8e19fc7b.map
    ~/ios-6015af56b91a3f224ae229507df9f15b.map

I see that we get a warning related to source map reference. Few comments/questions:

  1. We have modified the dist to use the commit hash instead of he updateId generated from expo, is that an issue?
  2. The move commands are to fulfill this instruction in the expo guide "Copy or rename the bundle names in the dist/bundles folder to match index.android.bundle (Android) or main.jsbundle (iOS)." Do we need to also rename the map files?
  3. We condensed the upload command to one (instead of doing it for each platform) is this an issue?

We are targeting to upgrade to Expo SDK 50 in a month, but I was hoping to get source maps up and running before upgrading. Obviously upgrading SDK versions has a much larger risk/regression scope.

ShaneMcNamara avatar Mar 12 '24 18:03 ShaneMcNamara

@ShaneMcNamara Thank you for the details, yes, you have to upload the Android and iOS separately, so the sentry-cli can correctly link the bundle and source map.

Let us know if that helped.

krystofwoldrich avatar Mar 14 '24 09:03 krystofwoldrich

@krystofwoldrich - It doesn't seem to have helped.

Here are the new update steps and outputs:

- find dist/bundles/android-*.map -exec node_modules/@sentry/cli/bin/sentry-cli releases files mobile@$RELEASE upload-sourcemaps --dist $BITBUCKET_COMMIT-android --rewrite dist/bundles/index.android.bundle {} --org ontraccr \;
> Found 1 file
> Found 1 file
> Analyzing 2 sources
> Rewriting sources
> Adding source map references
> Bundled 2 files for upload
> Bundle ID: ce9752fe-0630-52cc-89fd-b42d2950e79f
> Uploaded files to Sentry
> File upload complete (processing pending on server)
> Organization: ontraccr
> Project: mobile
> Release: [email protected]
> Dist: 6541d0b69ff81f902d51d46f8fa1f54287bc5254-android
> Upload type: artifact bundle
Source Map Upload Report
  Minified Scripts
    ~/index.android.bundle (sourcemap at android-757cbaadc11f4c562d62754b597392ca.map)
  Source Maps
    ~/android-757cbaadc11f4c562d62754b597392ca.map
- find dist/bundles/ios-*.map -exec node_modules/@sentry/cli/bin/sentry-cli releases files mobile@$RELEASE upload-sourcemaps --dist $BITBUCKET_COMMIT-ios --rewrite dist/bundles/main.jsbundle {} --org ontraccr \;
> Found 1 file
> Found 1 file
> Analyzing 2 sources
> Rewriting sources
> Adding source map references
> Bundled 2 files for upload
> Bundle ID: eb6ff50e-0f67-5187-aef0-b13991295998
> Uploaded files to Sentry
> File upload complete (processing pending on server)
> Organization: ontraccr
> Project: mobile
> Release: [email protected]
> Dist: 6541d0b69ff81f902d51d46f8fa1f54287bc5254-ios
> Upload type: artifact bundle
Source Map Upload Report
  Minified Scripts
    ~/main.jsbundle (sourcemap at ios-e7b2ed22b8be77d1ce047ac551f123f0.map)
  Source Maps
    ~/ios-e7b2ed22b8be77d1ce047ac551f123f0.map

Issue Link

Error Message: Screenshot 2024-03-14 at 2 52 21 PM

And associated release+dist: Screenshot 2024-03-14 at 2 52 28 PM

Please let me know if there is any other information you need

ShaneMcNamara avatar Mar 14 '24 21:03 ShaneMcNamara

@ShaneMcNamara Thank you for the link, we will check why the warning is still showing,

but as fas, as I see your stack trace is correctly symbolicated, so you can ignore the unminify button.

krystofwoldrich avatar Mar 15 '24 12:03 krystofwoldrich

Thanks @krystofwoldrich. I'll leave it to you to decide whether you want to close this based or not, based off the warning still appearing.

ShaneMcNamara avatar Mar 15 '24 19:03 ShaneMcNamara

+1, I have symbolicated stack traces yet the warning appears

rikur avatar Mar 17 '24 17:03 rikur

  • Closing as duplicate of https://github.com/getsentry/sentry/issues/67148

krystofwoldrich avatar Apr 05 '24 12:04 krystofwoldrich