sentry-dart
sentry-dart copied to clipboard
Issues from Android and iOS appear differently in the Sentry UI from a Flutter app
Platform
Flutter Mobile
Obfuscation
Enabled
Debug Info
Enabled
Doctor
[✓] Flutter (Channel stable, 3.16.9, on Ubuntu 23.10 6.5.0-27-generic, locale en_GB.UTF-8) • Flutter version 3.16.9 on channel stable at /home/freed/opt/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 41456452f2 (3 months ago), 2024-01-25 10:06:23 -0800 • Engine revision f40e976bed • Dart version 3.2.6 • DevTools version 2.28.5
Version
7.16.1
Steps to Reproduce
I have a Flutter project and build for Android and iOS. I am using the dart sentry plugin to upload debug symbols and sources, and use the Sentry CLI directly to create releases in Sentry. Further I'm using the Sentry CLI to upload pro-guard files for Android and explicity specify the UUID when initializing Sentry.
I've added my package name in inAppIncludes in the app.
I have also set up the Github integration and code mappings to point to the relevant directories.
The Android and iOS versions are built separately as part of CI. I use an automatically generated unique build number for each (time based) and infer the version from git tags, resulting in release identifiers liks [email protected]+40001 and [email protected]+40041. These are distinct releases/packages in Sentry. This all works and they show up as expected.
Expected Result
- Android and iOS issues are grouped together.
- Source context is available for exceptions from my code
- In-app frames are detected and flagged
- Links to GitHub work on stack trace frames
Actual Result
- Android and iOS issues show up separately, not grouped
- Source context for stacktraces are showing up in Android issues
- Android stack frames are not flagged as in-app
- Android issues do not have a link to Github
- Source context for stacktraces are not visible for iOS issues
- iOS issues do have stack frames linked correctly to Github
- iOS issues have the stack frames correctly detected as in-app
Further, the paths reported are different between the two cases (which may explain some of the other issues/differences)
- For Android, the file path reported when hovering over the filename in the web UI is an absolute path to the file as it existed when the project was built (in this case a path starting with /home/circleci/project
- For iOS, the file path is prefixed with my package name (package:mypackage/somedir/file.dart). This path does not include "lib".
Are you willing to submit a PR?
Yes
Hey can you send the links to these events to me at [email protected] so we can take a closer look
Could you also provide a reproducible sample app? It would greatly help in debuggin this
So i tried to reproduce this using the TestFlight iOS example, and an Android release build. For the latter, the plugin was also executed so new debug symbols were uploaded. I also set the build number to match iOS. At first this did
List of Reported Issues/Problems
Android and iOS issues show up separately, not grouped
Yes. The issues were correctly grouped for iOS (release) and Android (release) build. This was only not working when one platform did not have --split-debug-info and '--obfuscate' enabled and the other did.
| iOS (Release) | Android (Release) |
|---|---|
Source context for stacktraces are showing up in Android issues
Yes, as seen above.
Android stack frames are not flagged as in-app
Yes, only in iOS.
| Not in-app |
|---|
Android issues do not have a link to Github
Yes, see above.
Source context for stacktraces are not visible for iOS issues
No, this works with --split-debug-info and '--obfuscate' flags. See screenshots above.
iOS issues do have stack frames linked correctly to Github
No, this works with --split-debug-info and '--obfuscate' flags. See screenshots above.
iOS issues have the stack frames correctly detected as in-app
Yes, see screenshots above.
sentry.io Issues
Still need to verify if we correctly setup the TestFlight release build.
Updated the comments above. It looks like everything works, except detecting in-app frames on Android and linking to GH.
@buenaflor Looking through this, i think we need to set the in-app flag on the backend. On the client, we do not have the package if the app is obfuscated, which is how in-app frames are determined.
| Default | Obfuscated |
|---|---|
@Swatinem hey, you got a clue for two identical stacktraces (iOS & Android) where one has every frame marked as inApp (iOS) and the other does not have any marked(Android)? I guess the stacktrace rules are affecting it?
Yes, the stacktrace rules have an effect there. There is also in_app normalization, which defaults a None value to true/false depending on presence of either flag anywhere else in the stack trace. So its possible that iOS (either through the SDK, or a builtin enhancer rule) sets that flag on one system frame, and then other frames are being defaulted.
I don’t have enough context here to be of more help.
@krystofwoldrich in RN triggering the same error on iOS and Android will result being grouped correct? Do you do anything specific there to make that happen?
If RN App throws error in JS throw new Error('My first error') this will result in one issue in Sentry for both iOS and Android, because the in_app JS frames will be the same.
yeah makes sense, I suppose we also want the same behaviour for Flutter
Improvements are live:
- stacktraces on both ios and android are now properly set inApp
- iOS and Android events of the same error are now grouped together
I will close this issue and create a new issue regarding the Github stacktrace links