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

JS Error is reported as Java Exception #3078

Closed
5 of 11 tasks
fantasyado opened this issue May 18, 2023 · 8 comments
Closed
5 of 11 tasks

JS Error is reported as Java Exception #3078

fantasyado opened this issue May 18, 2023 · 8 comments

Comments

@fantasyado
Copy link

fantasyado commented May 18, 2023

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

SDK:

  • @sentry/react-native (5.5.0)
  • react-native-sentry (<= 0.43.2)

SDK version: 0.0.0

react-native version: 0.70.5

Are you using Expo?

  • Yes -- bare flow
  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)
  • on-premise

If you are using sentry.io, please post a link to your issue so we can take a look:

Link to issue

Configuration:

(@sentry/react-native)

Sentry.init({
  dsn: 'https://...@sentry.io/...'
  // other options
  enabled: !__DEV__
});

I have following issue:

[Description]

Steps to reproduce:

  • run xcode build script
     xcodebuild -workspace $schemeName.xcworkspace   -scheme $schemeName -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14 Pro Max,OS=16.1'  
    
  • install the ipa to simulator and trigger a error

Actual result:

[Actual result]
The source map seems not used to display the error source code location.
image
and when I check the sourceMaps tab in sentry.io it shows no bundle connected to this release

image

Expected result:

[Expected result]
The source map should be used to parse the error stacktrace.

Please help on this, Thanks !

@fantasyado fantasyado changed the title no bundle connected to this release sentry no bundle connected to this release May 18, 2023
@fantasyado
Copy link
Author

update: after I set release and dist in Sentry.init and doing

export SENTRY_ORG=my-org
export SENTRY_PROJECT=my-project 

in the build script , the source map uploading seems normal on sentry like this
image
but the issue detail still not showing method name and a warning popped up:
image

issue link

tried both jsc and hermes and both are same result.

@krystofwoldrich
Copy link
Member

krystofwoldrich commented May 19, 2023

Hi,
thank you for the link and details. It looks like you are using bare @sentry/react-native, so you will have to add the following integration to match the bundle name with the uploaded artifacts name.

Sentry.init({
  integrations: [
    new RewriteFrames({
      iteratee: (frame) => {
        if (frame.filename && frame.filename !== '[native code]') {
          frame.filename =
            Platform.OS === 'android' ? 'app:///index.android.bundle' : 'app:///main.jsbundle';
        }
        return frame;
      },
    }),
  ]
})

This code is added by the sentry-expo automatically.

Let us know if this helped, if not we can reopen the issue con investigate more.

@fantasyado
Copy link
Author

fantasyado commented May 19, 2023

@krystofwoldrich Thanks very much for your reply. after I added the integrations option to Sentry.init, iOS seems working fine now but Android is still not. one thing I noticed is when I run the iOS build, the source map appeared on both tabs (Artifact Bundles, release-bundles) but Android only appeared in release-bundles with warning.

Besides, Android build speed is much faster than iOS, during the build process I didn't see too much upload traffic but it can be observed during iOS build process.

android:
image
iOS:
image

Is there any other settings I am missing?

@krystofwoldrich
Copy link
Member

I'm happy to hear that it helped a bit. A assume both the iOS and Android errors use the same JS code?

The issue from Android is a Java exception with JS stack trace in its message. Sentry doesn't symbolicate the message content.

We handle this case here. Are you initializing SentryAndroid manually?

@fantasyado
Copy link
Author

@krystofwoldrich You are right, both the iOS and Android errors use the same JS code and I did not initialize SentryAndroid manually. what I have done is init sentry with release and dist and export same release/dist env var in build script.

@krystofwoldrich
Copy link
Member

Would you be able to share a minimal reproducible example for the Android JavascriptException? As I mentioned you should get JS Error but you are getting Java Exception.

@krystofwoldrich krystofwoldrich changed the title no bundle connected to this release JS Error is reported as Java Exception May 30, 2023
@fantasyado
Copy link
Author

OK, I‘ll try to create a minimal example when I got time. currently cause we also need to integrate with codepush, we'll upload the source map manually anyway.

@krystofwoldrich
Copy link
Member

Closing as duplicate of #3126

@krystofwoldrich krystofwoldrich closed this as not planned Won't fix, can't repro, duplicate, stale Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants