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.

Hermes, sentry source map is showing wrong code in both codepush and production build, but not when running in dev

See original GitHub issue

Environment

  • How do you use Sentry?

self-hosted Sentry 21.4.037b2bca

  • Which SDK and version?

@sentry/react-native: 3.1.1

Steps to Reproduce

git clone https://github.com/pass-culture/pass-culture-app-native.git
cd pass-culture-app-native
nvm use
yarn 
  1. Source this file https://github.com/pass-culture/pass-culture-app-native/blob/master/scripts/upload_sourcemaps_to_sentry.sh#L7-L35 with . scripts/upload_sourcemaps_to_sentry.sh, this follow the step to generate sentry source map for react native with hermes
  2. upload the source map to sentry using the same script
  3. generate an error like in here: https://github.com/pass-culture/pass-culture-app-native/blob/master/src/features/cheatcodes/pages/Navigation/Navigation.tsx#L86-L92

Expected Result

I expect to see the error in sentry with the source maps showing the proper code, like when I run the app in __DEV__,

image

Actual Result

Production build does show some unexpected source map for the same error :

image

When I check the minified version, we can clearly see that the error happen in onPress:

image

This is the same error with Android :

image

Again we clearly see that the error is in onPress:

image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:43 (17 by maintainers)

github_iconTop GitHub Comments

3reactions
jennmuengcommented, May 12, 2022

@kopax-polyconseil @marandaneto I apologize for the delay, I finally finished my finals.

Anyways, I’ve reproduced the issue with the bad source maps, however, I found that if I use the source maps that are automatically generated by our react native build scripts those work perfectly. Upon further investigation I found that the bundle output from the build script is correct, however when you manually run the bundle command, the output is not the same.

I will need some time to investigate this further.

2reactions
jennmuengcommented, May 13, 2022

@kopax-polyconseil For iOS, I just tried on your reproduction, you will want to upload the original bundle.

I am not able to test with code push right now, but I would assume it would use the original bundle as well.

This is very unexpected behavior and is not consistent with how it was previously…I will get to the bottom of this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native Hermees source maps showing wrong code
Hello everyone, I use Sentry, react native and hermes. I have build the source map using this script : SOURCEMAPS_DIR="sourcemaps" ...
Read more >
Troubleshooting for JavaScript | Sentry Documentation
In case the source map files do not contain your original source code ( sourcesContent ), you must additionally provide the original source...
Read more >
Sentry React-Native with CodePush not using source maps
I'm using CodePush to upload my app and I want Sentry to handle my errors since the appcenter diagnostics are not very good....
Read more >
@sentry/cli | Yarn - Package Manager
Upon sourcemap uploading the sentry-cli tool is now automatically attempting to find matching sourcemaps and emit a Sourcemap header with the correct reference....
Read more >
Sentry React-Native with CodePush not using source maps ...
export SENTRY_PROPERTIES=./ios/sentry.properties sentry-cli react-native appcenter \ account/project \ ios ./build/codePush \ --release-name "1.0" \ --dist ...
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