question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Source maps not recognized for Android

See original GitHub issue

Environment

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

  1. ionic build --prod - builds the app and creates source maps in www folder
  2. sentry-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 Sentry
  3. npx cap sync - copies the build to android folder
  4. run the app and cause an error
  5. 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:

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:closed
  • Created 2 years ago
  • Comments:20 (9 by maintainers)

github_iconTop GitHub Comments

5reactions
michalsisakcommented, Feb 10, 2022

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’s versionCode in build.gradle) was not included with uploaded sourcemaps. I am not sure how exactly was dist created in the first place since we were not using it in Sentry.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 both Sentry.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.

1reaction
kamilogorekcommented, Feb 10, 2022

@michalsisak your dist is set for the event, but not for the uploaded artifacts. dist can be somewhat understood as directories for artifacts that share the same release. Please see: https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js/#verify-artifact-distribution-value-matches-value-configured-in-your-sdk

Read more comments on GitHub >

github_iconTop Results From Across the Web

The source maps don't work in Developer Tools when ...
When I inspect my Android device using Developer Tools and the exact same source code, the javascript source map isn't extracted and I...
Read more >
Typescript sourcemaps not displayed in Ionic 2 on an Android ...
I face a weird Ionic2 behaviour. When i deploy my app to a simulator, i can see the .ts file sourceMap in the...
Read more >
Troubleshooting Source Maps for Cordova
Troubleshooting Source Maps · Verify a release is configured in your SDK · Verify artifacts are uploaded · Verify sourceMappingURL is present ·...
Read more >
Source Map Troubleshooting - Rollbar Docs
Sometimes source maps can be generated with no content in them, or in an invalid format, e.g. base64. Check the source maps that...
Read more >
React Native source maps - JavaScript - Bugsnag docs
Using our source map library you can upload source maps to unminify stack traces and get human-readable method names, files, and line numbers....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found