sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

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

Open anagovitsyn opened this issue 1 year ago • 8 comments

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://[email protected]/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:

  • Step 1 generate bundle and sourcemap according to documentation https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/hermes/

  • Step 2 upload sourcemaps to sentry (screenshot of uploading command/process attached)

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 avatar Apr 27 '24 14:04 anagovitsyn

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

anagovitsyn avatar Apr 27 '24 16:04 anagovitsyn

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.

krystofwoldrich avatar Apr 30 '24 19:04 krystofwoldrich

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

anagovitsyn avatar May 02 '24 12:05 anagovitsyn

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?

krystofwoldrich avatar May 02 '24 15:05 krystofwoldrich

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

anagovitsyn avatar May 03 '24 11:05 anagovitsyn

Hi @anagovitsyn, thank you for the details.

From the package.json I see you are using [email protected] with [email protected].

But RN ships with [email protected], can you upgrade to that version?

krystofwoldrich avatar May 03 '24 11:05 krystofwoldrich

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

anagovitsyn avatar May 03 '24 12:05 anagovitsyn

@hubertdeng123 Can you try to isolate the issue, does it happen without createSentryMetroSerializer? Or without Sentry only with [email protected] upgrade?

krystofwoldrich avatar May 06 '24 16:05 krystofwoldrich

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

getsantry[bot] avatar May 28 '24 07:05 getsantry[bot]

@hubertdeng123 Can you try to isolate the issue, does it happen without createSentryMetroSerializer? Or without Sentry only with [email protected] upgrade?

All problems with build errors finaly closed. There was problem using react-navigation package alone i.e. import { Header } from 'react-navigation' which is not supported after upgrading to use centry. This error was preceeding message of "GoGym" is not registed module, and was the couse of "registerComponent wasn't called"

anagovitsyn avatar Jun 27 '24 13:06 anagovitsyn

And now I have upon iOS successful build this error message image

so it still doen't solved. What are next steps to solve the issue? Our server-side centry version image

anagovitsyn avatar Jun 27 '24 13:06 anagovitsyn

@anagovitsyn If you can, upgrade to the latest Sentry on your server, that will solve the issue.

Or add export AUTO_RELEASE=true # Automatically detect release from Xcode project which will add the required slug. https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#configure-automatic-source-maps-upload

krystofwoldrich avatar Jul 08 '24 10:07 krystofwoldrich

Now everything is solved, after I have upgraded sentry client version to 5.19.1. It works ok with backend 23.5.2 and now I can see mapping of errors to source code.

Thank you

anagovitsyn avatar Jul 08 '24 12:07 anagovitsyn