Skip to content

Uploaded Android bundle is 0MB and event processing keeps failing due to it #2683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
6 of 11 tasks
StampixSMO opened this issue Dec 8, 2022 · 15 comments
Closed
6 of 11 tasks

Comments

@StampixSMO
Copy link

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

SDK:

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

SDK version: 4.10.1

react-native version: 0.70.6

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/stampix-zb/issues/3496972388/?project=6259211&query=is%3Aunresolved+os.name%3AAndroid&referrer=issue-stream&statsPeriod=14d

Configuration:

(@sentry/react-native)

Sentry.init({
  dsn: 'https://[email protected]/...'
  // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
  // We recommend adjusting this value in production.
  tracesSampleRate: SENTRY_TRACING_RATE,
  enableNdkScopeSync: true,
  integrations: [
    new Sentry.ReactNativeTracing({
      // Pass instrumentation to be used as `routingInstrumentation`
      routingInstrumentation
      // ...
    })
  ],
  environment: SENTRY_ENVIRONMENT,
  // Any data beyond this depth will be trimmed and marked using its type instead ([Object] or [Array]).
  normalizeDepth: 10,
  beforeBreadcrumb: (breadcrumb, hint) => {
    // We log some more information for XHR requests to our GQL API, since only the method and URL is useless for debugging
    if (breadcrumb.category === 'xhr' && hint) {
      try {
        const { query, variables } = JSON.parse(hint.input);
        if (!breadcrumb.data) breadcrumb.data = {};
        breadcrumb.data.query = query;
        breadcrumb.data.variables = variables;
      } catch {}
    }
    return breadcrumb;
  },
  maxValueLength: 500,
  // Don't auto initialize, instead we do it manually
  // See https://docs.sentry.io/platforms/react-native/manual-setup/native-init/
  autoInitializeNativeSdk: false
});

Note that we've just now disabled auto initialization, the issue at hand was present before we did disabled this.


I have following issue:

Every new release suddenly started having empty Android bundles, giving us the Invalid location in sourcemap errors at the top of Android-reported events.
Using the Sentry CLI to debug the particular events reveals the same and the sourcemap uploads in the project Settings also clearly shows it's empty (see screenshot).
image

Note that this used to work in the past, but it's hard to debug where it started occurring since the older events are long removed due to retention periods.

For iOS, this works perfectly and all is well.

Steps to reproduce:
Just make a release bundle, which automatically uploads the bundle to our Sentry environment.

Actual result:

Minified stack traces in our events and an error banner on top.

Expected result:

Proper reported events with stack traces

@marandaneto
Copy link
Contributor

@StampixSMO RN 0.70.6 has Hermes enabled by default, not sure if you had before.
https://docs.sentry.io/platforms/react-native/manual-setup/hermes/
Also, take a look at this https://docs.sentry.io/platforms/react-native/troubleshooting/#react-native-069-and-higher
Besides upgrading the SDK to the latest version, let us know if that helps.

@StampixSMO
Copy link
Author

StampixSMO commented Dec 9, 2022

Hi @marandaneto Thanks for the reply, appreciated!

We've had Hermes quite a while already, so don't think that's the issue here. Additionally, we've got the latest SDK version (see above) in the issue description.
The issue is also that the bundle is 0MB, the source maps seem to be fine and are uploaded correctly as far as I can tell, see the screenshot above.

For the react-native.config.js adjustments, we have this patch file so that should all be good already

diff --git a/node_modules/@sentry/react-native/react-native.config.js b/node_modules/@sentry/react-native/react-native.config.js
index f85fa01..19782b1 100644
--- a/node_modules/@sentry/react-native/react-native.config.js
+++ b/node_modules/@sentry/react-native/react-native.config.js
@@ -1,18 +1,10 @@
 module.exports = {
   dependency: {
     platforms: {
-      ios: {
-        sharedLibraries: ['libz']
-      },
+      ios: {},
       android: {
         packageInstance: 'new RNSentryPackage()'
       }
-    },
-    hooks: {
-      postlink:
-        'node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android',
-      postunlink:
-        'node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android --uninstall'
     }
   }
 };

Any further suggestions we can try?

Edit: also adding the output of our build:

2022-12-07T16:06:17.8855148Z [16:06:17]: ▸ �[35m> Task :app:[email protected]+3049_3049�[0m
2022-12-07T16:06:17.8856738Z [16:06:17]: ▸ �[35mProcessing react-native sourcemaps for Sentry upload.�[0m
2022-12-07T16:06:17.8858001Z [16:06:17]: ▸ �[35m> Analyzing 2 sources�[0m
2022-12-07T16:06:18.0852467Z [16:06:18]: ▸ �[35m> Rewriting sources�[0m
2022-12-07T16:06:19.5855710Z [16:06:19]: ▸ �[35m> Adding source map references�[0m
2022-12-07T16:06:19.9853402Z [16:06:19]: ▸ �[35mUploading sourcemaps for release [email protected]+3049 distribution 3049�[0m
2022-12-07T16:06:20.7854978Z [16:06:20]: ▸ �[35m> Task :expo-modules-core:prepareFolly�[0m
2022-12-07T16:06:20.7856134Z [16:06:20]: ▸ �[35m> Task :expo-modules-core:prepareThirdPartyNdkHeaders�[0m
2022-12-07T16:06:20.8853706Z [16:06:20]: ▸ �[35m> Task :expo-modules-core:extractAARHeaders�[0m
2022-12-07T16:06:20.9853384Z [16:06:20]: ▸ �[35m> Task :expo-modules-core:extractJNIFiles�[0m
2022-12-07T16:06:21.9856227Z [16:06:21]: ▸ �[35m> Task :expo-modules-core:extractReactNativeAARRelease�[0m
2022-12-07T16:06:21.9857665Z [16:06:21]: ▸ �[35m> Task :app:[email protected]+3049_3049�[0m
2022-12-07T16:06:21.9858708Z [16:06:21]: ▸ �[35m> Bundled 2 files for upload�[0m
2022-12-07T16:06:22.6853284Z [16:06:22]: ▸ �[35m> Uploaded release files to Sentry�[0m
2022-12-07T16:06:22.8855219Z [16:06:22]: ▸ �[35m> File upload complete (processing pending on server)�[0m
2022-12-07T16:06:22.8856124Z [16:06:22]: ▸ �[35m> Organization: stampix-zb�[0m
2022-12-07T16:06:22.8861459Z [16:06:22]: ▸ �[35m> Project: X�[0m
2022-12-07T16:06:22.8863003Z [16:06:22]: ▸ �[35m> Release: [email protected]+3049�[0m
2022-12-07T16:06:22.8863963Z [16:06:22]: ▸ �[35m> Dist: 3049�[0m
2022-12-07T16:06:22.8864828Z [16:06:22]: ▸ �[35mSource Map Upload Report�[0m
2022-12-07T16:06:22.8866044Z [16:06:22]: ▸ �[35mMinified Scripts�[0m
2022-12-07T16:06:22.8867113Z [16:06:22]: ▸ �[35m~/index.android.bundle (sourcemap at index.android.bundle.map)�[0m
2022-12-07T16:06:22.8868115Z [16:06:22]: ▸ �[35mSource Maps�[0m
2022-12-07T16:06:22.8871896Z [16:06:22]: ▸ �[35m~/index.android.bundle.map�[0m
2022-12-07T16:06:22.8873047Z [16:06:22]: ▸ �[35m> Task :app:bundleQaReleaseJsAndAssets_SentryUploadCleanUp SKIPPED�[0m
2022-12-07T16:06:23.1856932Z [16:06:23]: ▸ �[35m> Task :app:[email protected]+3049_3049�[0m
2022-12-07T16:06:23.1858928Z [16:06:23]: ▸ �[35mSentry Logger [info]: Reading source map from /home/runner/work/X/X/android/app/build/generated/sourcemaps/react/qa/release/index.android.bundle.map�[0m
2022-12-07T16:06:23.1860698Z [16:06:23]: ▸ �[35mSentry Logger [info]: Saving modules to /home/runner/work/X/X/android/app/src/main/assets/modules.json�[0m
2022-12-07T16:06:23.1862344Z [16:06:23]: ▸ �[35mSentry Logger [info]: Resolving modules from paths /home/runner/work/X/X/android/app/src/main/assets/modules.json�[0m
2022-12-07T16:06:23.1864020Z [16:06:23]: ▸ �[35mSentry Logger [info]: Modules collected and saved to: /home/runner/work/X/X/android/app/src/main/assets/modules.json�[0m

@marandaneto
Copy link
Contributor

@StampixSMO being 0 bytes is fine I don't remember if for Hermes or RAM bundles, have to check it.
@krystofwoldrich will further investigate.

@krystofwoldrich krystofwoldrich moved this to Needs Discussion in [DEPRECATED] Mobile SDKs Dec 12, 2022
@krystofwoldrich krystofwoldrich moved this from Needs Discussion to Needs Investigation in [DEPRECATED] Mobile SDKs Dec 12, 2022
@krystofwoldrich
Copy link
Member

krystofwoldrich commented Dec 12, 2022

Hi @StampixSMO,
could you send us an example app with instructions on how to build it so we can reproduce the issue?

@StampixSMO
Copy link
Author

Hi @StampixSMO, could you send us an example app with instructions on how to build it so we can reproduce the issue?

Publicly I cannot easily share an example app without reproducing our entire app including fastlane CI etc .. Is there an option to privately share this?

Using bare workflow btw

@krystofwoldrich
Copy link
Member

@StampixSMO Would you be able to recreate the issue with a clean project, just setting up the minimum needed, maybe the issue show even without Fastlane?

@krystofwoldrich krystofwoldrich moved this from Needs Investigation to Needs More Information in [DEPRECATED] Mobile SDKs Dec 13, 2022
@marandaneto
Copy link
Contributor

A minimal reprocible exampe would do, that means.

npx react-native init Name
yarn add @sentry/react-native
npx @sentry/wizard -i reactNative -p ios android

Steps to reproduce...

@StampixSMO
Copy link
Author

StampixSMO commented Dec 14, 2022

A minimal reprocible exampe would do, that means.

npx react-native init Name
yarn add @sentry/react-native
npx @sentry/wizard -i reactNative -p ios android

Steps to reproduce...

Allow me some time to set this up and try to reproduce, be back soon.

@StampixSMO
Copy link
Author

Hey @krystofwoldrich I've set up a new project and new project, build the app in release mode and the bundle is again 0MB.
However, the issues on that project do not contain errors.

So to me, it's weird that the main bundle is 0MB, because I thought that was the reason we keep getting "Invalid location in sourcemap" on ALL our Android events in our main app.

We've tried the CLI debugging a few times already, but the only clue I could find is the empty bundle file.

The output of the CLI is always the same:

✔ Fetched data for event: 8bddc902c6f6456ab57efbf86feb1189
✔ Event has release name: [email protected]+3038
✔ Event has a valid exception present
✔ Event has a valid stacktrace present
✖ Event exception stacktrace selected frame (0) has incorrect abs_path (valid url is required). Found native

Indeed, the issue event mentions native:// but no idea why that is. Any further suggestions to try?

@krystofwoldrich
Copy link
Member

@StampixSMO Sadly I don't know what to do at this moment. The only suggestion I have is to compare the newly created project to the original one and try to find the differences in settings, RN version, etc.

@krystofwoldrich krystofwoldrich moved this from Needs More Information to Needs Discussion in [DEPRECATED] Mobile SDKs Dec 16, 2022
@krystofwoldrich krystofwoldrich moved this from Needs Discussion to Needs More Information in [DEPRECATED] Mobile SDKs Dec 16, 2022
@StampixSMO
Copy link
Author

@krystofwoldrich Is it normal that the bundle is 0MB?

@marandaneto
Copy link
Contributor

@krystofwoldrich Is it normal that the bundle is 0MB?

Yes, as mentioned here #2683 (comment)
Its for Hermes apparently, @krystofwoldrich please add a note to https://docs.sentry.io/platforms/react-native/manual-setup/hermes/ that being 0 bytes on Android is fine.

About the issue, @StampixSMO please take a look into @krystofwoldrich questions #2683 (comment)

@krystofwoldrich
Copy link
Member

@StampixSMO Any updates?

@StampixSMO
Copy link
Author

@krystofwoldrich No, I've been out and haven't been able to look into the diff. On my TODOs!

@krystofwoldrich
Copy link
Member

I will close this for now. But please comment down below when you get back to it and we can reopen it and investigate more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants