Source maps not recognized for Android
See original GitHub issueEnvironment
MacOS, Android 11 Sentry SaaS (sentry.io)
Which SDK and version? sentry/angular - 6.13.2, sentry/capacitor: 0.4.0, Angular: 11.0.0, Ionic: 5.29.0, Capacitor: 3.0.1
Steps to Reproduce
ionic build --prod
- builds the app and creates source maps inwww
foldersentry-cli releases --org "org_name" --project "project_name" files "project_name@1.0.2" upload-sourcemaps ./www -x .js -x .map --validate --verbose --rewrite --strip-common-prefix
- uploads source maps to Sentrynpx cap sync
- copies the build toandroid
folder- run the app and cause an error
- check Sentry and see whether source maps were recognized
Expected Result
I expect the same error on iOS and Android to show the same stack trace.
Actual Result
On iOS it works flawlessly. On Android I get an alert:
Source code was not found Url | app:///polyfills-es2015.906050c326169a72ef3f.js
. I can confirm there is a file uploaded with this name for given release. The issue shows the correct release number as well.
When I compare iOS error and the Android one I can only see a difference in url
paramater:
- iOS -
capacitor://localhost/tabs/today
- Android -
http://localhost/tabs/today
I went through data sent to Sentry, inspected frames in stacktrace and can confirm that filenames are the same for both platforms: app:///polyfills-es2015.906050c326169a72ef3f.js
I was going through documentation, different Github issues and any StackOverflow thread I could find which gave me few worthwhile theories:
- https://github.com/ionic-team/ionic-framework/issues/16455
- https://github.com/ionic-team/ionic-cli/issues/3802
- This solution from ionic team where stacktrace is being modified. Part of Ionic Sentry webinar: video
I apologize if I am doing something wrong or missed something but I got quite stuck. How can I make Sentry to recognize Android stack trace?
Issue Analytics
- State:
- Created 2 years ago
- Comments:20 (9 by maintainers)
Top GitHub Comments
Thank you @kamilogorek for correctly pointing out the problem!
A summary of what happened: Sourcemaps were not recognized for Android while working great with iOS. The problem was that
dist
(for us it was Android’sversionCode
inbuild.gradle
) was not included with uploaded sourcemaps. I am not sure how exactly wasdist
created in the first place since we were not using it inSentry.init()
. It was part of Android events but not iOS ones. That’s why only Android sourcemaps were not working properly.The solution is to include
dist
in bothSentry.init()
and when uploading sourcemaps:sentry-cli releases files <release_name> upload-sourcemaps ./www --dist <dist>
. More info about it: Sentry Capacitor source maps and the link from Kamil.Alternative solution would be not including
dist
at all but I am not quite sure as how to achieve that.Hopefully it helps someone Thank you again. I will close the issue now as my problem has been solved. @Sampath-Lokuge if you are experiencing other problem ( you are mentioning not working both platforms) please open a new issue.
@michalsisak your
dist
is set for the event, but not for the uploaded artifacts.dist
can be somewhat understood asdirectories
for artifacts that share the samerelease
. Please see: https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js/#verify-artifact-distribution-value-matches-value-configured-in-your-sdk