getsentry / sentry-react-native

Official Sentry SDK for React Native
https://sentry.io
MIT License
1.57k stars 337 forks source link

app://main.jsbundle is empty in Sentry release artifacts after building with EAS (Expo) #3919

Closed avogel3 closed 4 months ago

avogel3 commented 4 months ago

OS:

Platform:

SDK:

SDK version: ~5.20.0

react-native version: 0.73.6

Are you using Expo?

Are you using sentry.io or on-premise?

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

Link to issue

** release 189, but 190 has the same problem

Configuration:

(@sentry/react-native)

Sentry.init({
  dsn: Config.SENTRY_DSN,
  enableNative: true,
  debug: true,
  beforeBreadcrumb: excludeGraphQLFetch,
  ignoreErrors: ["Network request failed"],
});

Description

After running a full build in EAS, our app://main.jsbundle artifact in Sentry is showing as 0.0 B, but the source map is there.

image

We recently upgraded our application to Expo 50. We were formerly using the sentry-expo library, but migrated to this package by following the guide.

After running a full build and release using EAS, I noticed that our error traces in Sentry weren't displaying like I expected. It looks like this is because the jsbundle file is empty.

Here's a snippet from our XCode logs for Sentry release 189, which appears to show that both files were uploaded to Sentry -

Using Hermes bundle and combined source map.
Processing react-native source maps for Sentry upload.
> Analyzing 2 sources
> Rewriting sources
> Adding source map references
> Bundled 2 files for upload
> Bundle ID: b304a1b8-61db-56e7-8a30-b4d4907a377f
> Uploaded files to Sentry
> File upload complete (processing pending on server)
> Organization: *******
> Project: field-app
> Release: ******@3.0.0+189
> Dist: 189
> Upload type: artifact bundle

Source Map Upload Report
  Scripts
    ~/main.jsbundle (sourcemap at main.jsbundle.map, debug id 0c21c417-93b6-4a59-954b-8eabceeee4ff)
  Source Maps
    ~/main.jsbundle.map (debug id 0c21c417-93b6-4a59-954b-8eabceeee4ff)

Actual result:

Bundle is empty, but source maps are present for the release of the full build

Expected result:

Bundle and source maps are present for the release of the full build

krystofwoldrich commented 4 months ago

Hi @avogel3, thank you for creating the issues.

The bundle size = 0 bytes is expected for Hermes bundles, as we only need the source map to symbolicate the stack trace.

Sadly the link here in the issue is broken so I'm not able to check the mentioned releases. (If you don't want to share it here publicly you can send it to krystof.woldrich@sentry.io or use our Discord)

When looking at the stack trace do you see the unminify button, this should give you more details about why you are not seeing the original stack trace.

This is example of how it should look:

Screenshot 2024-07-02 at 16 09 53

avogel3 commented 4 months ago

The bundle size = 0 bytes is expected for Hermes bundles, as we only need the source map to symbolicate the stack trace.

TIL, Appreciate that info!

I just sent you an email with another link to the issue.

I do not see an "unminify code" button. But for this particular issue, we call Sentry.captureMessage(message). I was expecting it to show the location of that call in the trace. Instead, it looks like the below. Is this expected?

image

krystofwoldrich commented 4 months ago

Thank you for the email, I've replied to it, just a small recap here.

This is a case of https://github.com/getsentry/sentry-react-native/issues/3097, it will be fixed in the next major version of the RN SDK. Could you replace captureMessage with captureException and set the level to info to get the same behaviour?

avogel3 commented 4 months ago

Yeah, we'll change to use captureException in the meantime

skinsapp commented 2 months ago

@krystofwoldrich Is there any reason why traces would stop working?

I'm using CodePush + Hermes, and everything was working with beautiful source maps showing on each issue, but now the traces stopped showing and the main.jsbundle is showing with 0 bytes, whereas before it wasn't.

Also, now the issue profile is missing a bunch of information:

Image

I tried upgrading to the latest appcenter + sentry cli's, and the issue persists. I really feel like something changed on Sentry's side, where perhaps they are now expecting additional/different parameters passed to init. Here's what I have (and what was working before):

const bundleId = Platform.OS === 'ios' ? config.bundleIdIos : config.bundleIdAndroid

const { appVersion, label: dist } = await codePush.getUpdateMetadata()
const release = `${bundleId}@${appVersion}+codepush:${dist}` // eg: com.skins.skins@1.9+codepush:v68

Sentry.init({
    dsn: config.sentry.native,
    tracesSampleRate: .1,
    release,
    dist
})

The funny thing is the Android bundle is having the same issue, but still successfully uploads both artifacts. Here's iOS:

Image

And here's Android:

Image

Android's issue profile also is missing data compared to before, but is able to at least determine the device:

Image

Neither show stack traces anymore.

I'm just putting this information here in case you've seen some of these clues. I'm really at a loss on my side. I've tried to revert any recent changes on my side to ensure the issue isn't coming from my end. But this has worked up until Summer.