Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcemaps are not correctly uploaded and crashes in issues don't reference JS source code #3779

Open
anagovitsyn opened this issue Apr 27, 2024 · 8 comments

Comments

@anagovitsyn
Copy link

OS:

  • [*] MacOS

Platform:

  • [*] iOS

SDK:

  • [*] @sentry/react-native (>= 1.0.0)

SDK version: 5.15.0

react-native version: 0.71.12

Are you using Expo?

  • [*] No

Are you using sentry.io or on-premise?

  • [*] on-premise

Configuration:

(@sentry/react-native)

Sentry.init({
    dsn: "https://fa8......e5@sentry.obs.mts.ru/694",
    tracesSampleRate: 1.0,
  });

I have the following issue:

  1. Upon manual upload of source maps script main.jsbundle uploaded with zero size
  2. Crash information for the release doesn't contain references to the JS source code

Steps to reproduce:

Actual result:

  • main.jsbundle is shown with zero bytes size in sourcemaps for the release
  • crash references in issues for the release are not pointing to the line numbers in JS source code

Expected result:

  • main.jsbundle is uploaded with it's original content and size
  • crash references in issues for the release are pointing to the JS source code

Screenshot1
Screenshot2
Screenshot3
Screenshot4

@anagovitsyn
Copy link
Author

For android upload source maps was successful, but still no references to source code
Screenshot5
Screenshot6

@krystofwoldrich
Copy link
Member

Hi @anagovitsyn,
thank you for the message,

have you setup Sentry in your metro.config.js? The uploaded source maps are missing Debug IDs to be linked to the correct source code.

I would also recommend updating to the latest SDK version, https://github.com/getsentry/sentry-react-native/releases/tag/5.22.0.

@anagovitsyn
Copy link
Author

anagovitsyn commented May 2, 2024

Hi @anagovitsyn, thank you for the message,

have you setup Sentry in your metro.config.js? The uploaded source maps are missing Debug IDs to be linked to the correct source code.

I would also recommend updating to the latest SDK version, https://github.com/getsentry/sentry-react-native/releases/tag/5.22.0.

Where can I get debug ids for matching source maps when upload using sentry-cli?
image

I see that sourcemaps are linked to the release, but still no references to source code in crashes
Screenshot7

@krystofwoldrich
Copy link
Member

Although the source maps are linked, the might not be the correct source maps for the build.

Debug IDs help with that making sure only the appropriate source maps are used.

The guide that you linked ensures Debug IDs are generated.

https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/hermes/

Could you share how does your metro.config.js looks like?

@anagovitsyn
Copy link
Author

anagovitsyn commented May 3, 2024

I used npx @sentry/wizard@latest -i reactNative command to setup sentry.
We have already customized metro.config.js, just added there code for sentry and got error, so it doesn't work showing this error

Simulator Screenshot - iPhone 15 Pro - 2024-05-03 at 14 45 44

Screenshot 2024-05-03 at 13 28 46

Screenshot 2024-05-03 at 14 24 29

here is package.json
package.json

@krystofwoldrich
Copy link
Member

Hi @anagovitsyn,
thank you for the details.

From the package.json I see you are using react-native@0.71.12 with metro@0.72.0.

But RN ships with metro@0.73.10, can you upgrade to that version?

@anagovitsyn
Copy link
Author

Thank you. I have upgraded metro to 0.73.10 and previous error 'size' of undefined had gone and now build is successful on both platforms. But now new error both on ios and android upon startup of the app, though nothing was changed in source code structure, and index.js where call to registerComponent is - is unchanged in comparison with code without sentry and all the updates to the packages.json.

Screenshot_1714740622

Here's updated package.json
package.json

@krystofwoldrich
Copy link
Member

@hubertdeng123 Can you try to isolate the issue, does it happen without createSentryMetroSerializer? Or without Sentry only with metro@0.73.10 upgrade?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for: Product Owner
Status: Waiting for: Community
Status: Needs More Information
Development

No branches or pull requests

2 participants