expo / sentry-expo

MIT License
202 stars 83 forks source link

Eas update, events source code was not found #313

Closed fuelkoy closed 1 year ago

fuelkoy commented 1 year ago

Summary

Hello
Source map shows correctly after initial build. But after first update the source code doesn't work anymore. It seems the source map is being updated with the new dist (Cli commad and --dist specified in sentry-expo docs; Using Sentry - Expo Documentation) but the bundle file is not updated with corresponding dist. With understanding this results source code to be missing in events that come from updated apps. After the script I see .map file is uploaded but the new .build file is not being found and thus not being uploaded.

Below is an image of sentry artifacts where at the top is .map uploaded after eas update and down are .bundle and .map files from build. Sieppaa

Because I didn't get script working from Using Sentry docs out of the box I used this little modified script with filled values: cross-env ./node_modules/@sentry/cli/bin/sentry-cli releases --org 'organization name' --project 'project name' files 'release name' upload-sourcemaps --dist 'Android Update ID' --rewrite dist/bundles/index.android.bundle dist/bundles/android-'hash'.map

With my understanding the script above should work, but it doesn't recognize .bundle file without the full name with extension. Is this due the usage of "cross env"? Nevertheless the script works with .js extension (dist/bundles/index.android.bundle > dist/bundles/index.android.bundle.js) and it uploads the .bundle file as shown in the below image. 213417420-d9289783-c76b-4721-9d8d-eb0bb88c7854

But then on Sentry release artifact name is ~/index.android.bundle.js. And Sentry throws the following error shown in the below image (If I understood correctly the problem is because of that artifact naming. Dist and release are correct in the event). 213692280-59cfb2e0-5398-4ff2-896c-04dde74f7baf

Thank you and thank you for this package!

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

Android

SDK Version (managed workflow only)

47

Environment

expo-env-info 1.0.5 environment info: System: OS: Windows 10 10.0.19045 Binaries: Node: 16.18.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.19 - C:\Program Files\nodejs\yarn.CMD npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD npmPackages: expo: ~47.0.8 => 47.0.8 react: 18.1.0 => 18.1.0 react-native: 0.70.5 => 0.70.5 Expo Workflow: managed

Reproducible demo or steps to reproduce from a blank project

This minimal repository is made by krystofwoldrich and I used it to test described behavior. Repository step by step (in the commits) adds sentry-expo into a new expo project. Only thing I added in addition to the repository in my testing was "jsEngine": "hermes" to app.json, which can be seen from 0B index.android.bundle artifact.

Repo: https://github.com/krystofwoldrich/sentry-expo-sample-app

fuelkoy commented 1 year ago

Android*.js file simply needed to be changed to index.android.bundle not to index.android.bundle.js. Now source maps are showing correctly

krystofwoldrich commented 1 year ago

I'm happy that it worked out. Thanks for using the sample app :)