Skip to content

[Android] ReferenceError not being captured by Sentry #4321

Closed as not planned
Closed as not planned
@shanmukhdontuTWM

Description

@shanmukhdontuTWM

What React Native libraries do you use?

React Navigation, Hermes

Are you using sentry.io or on-premise?

sentry.io (SaS)

@sentry/react-native SDK Version

5.33.1

How does your development environment look like?

System:
  OS: macOS 14.7.1
  CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Memory: 1.37 GB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.20.4
    path: ~/.nvm/versions/node/v18.20.4/bin/node
  Yarn:
    version: 1.22.19
    path: /usr/local/bin/yarn
  npm:
    version: 10.7.0
    path: ~/.nvm/versions/node/v18.20.4/bin/npm
  Watchman:
    version: 2024.01.22.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK: Not Found
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10811636
  Xcode:
    version: /undefined
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.21
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.5
    wanted: 0.72.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: false
  newArchEnabled: Not found

Sentry.init()

Sentry.init({
      dsn: String(getConfig().SENTRY_DSN),
      environment: String(getConfig().SENTRY_ENVIRONMENT || 'Development'),
      enableUserInteractionTracing: false,
      enableAppStartTracking: false,
      attachScreenshot: false,
      integrations: [
        reactNativeTracingIntegration({
          routingInstrumentation: routingInstrumentation,
        }),
      ],
      debug: false,
      release: deviceInfoModule.getVersion(),
      dist:
        deviceInfoModule.getBundleId() + '-' + deviceInfoModule.getVersion(),
      enabled: true,
    });

Steps to Reproduce

The app is getting initialized with sentry without any issue, and also the sentry crash test is working.
In a component inside the App, it does not have a function imported and is called, which is throwing a ReferenceError locally but the same issue is not populated in sentry. When i converted the function to async, it did the trick.
The app is within the sentry error boundary and we were expecting the crash to show up, even for synchronous functions but thats not the case.
Can someone help look into this?

Expected Result

The event should be logged on sentry dashboard, sentry should capture one.

Actual Result

Sentry not able to capture ReferenceError crashes inside a React native component

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

Status

Done

Status

Waiting for: Community

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions