Skip to content

Wizard Installation doesn't work due to undocumented dependency on react-native-get-random-values #5249

@Traviskn

Description

@Traviskn

What React Native libraries do you use?

React Native without Frameworks

Are you using sentry.io or on-premise?

sentry.io (SaS)

@sentry/react-native SDK Version

6.22.0

How does your development environment look like?

After installing sentry into my react native app using the wizard, the test event was silently failing. After some digging, I found that the error was caused by the SDK trying to find a native library to get random values, like react-native-get-random-values. I did not notice any mention of this requirement in the documentation. I think it is worth mentioning somewhere that react native sentry needs a random number generator like react-native-get-random-values (or the expo equivalent if using expo)

npx react-native@latest info

System:
  OS: macOS 15.6.1
  CPU: (14) arm64 Apple M4 Pro
  Memory: 429.08 MB / 48.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 24.9.0
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 8.18.0
    path: ~/Developer/patient-mobile/QuickMD/node_modules/.bin/npm
  Watchman:
    version: 2025.09.15.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.5
      - iOS 18.5
      - macOS 15.5
      - tvOS 18.5
      - visionOS 2.5
      - watchOS 11.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.1 AI-251.26094.121.2513.14007798
  Xcode:
    version: 16.4/16F6
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 21.0.7
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.0.2
    wanted: ^20.0.0
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.81.4
    wanted: 0.81.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Sentry.init()

Sentry.init({
  dsn: 'https://383811712a885b48b808510a02df43f6@o4508456417427456.ingest.us.sentry.io/4510154701078528',

  // Adds more context data to events (IP address, cookies, user, etc.)
  // For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/
  sendDefaultPii: true,

  // Enable Logs
  enableLogs: true,

  tracesSampleRate: 1.0,

  debug: __DEV__,

  // uncomment the line below to enable Spotlight (https://spotlightjs.com)
  // spotlight: __DEV__,
});

Steps to Reproduce

  1. Install sentry into a vanilla react native app with no other dependencies using the wizard npx @sentry/wizard@latest -i reactNative --saas
  2. Create a button that captures the test error on press as instructed by the wizard: Sentry.captureException(new Error('First error'))
  3. The exception will not work and will not appear in the sentry error feed until after you install react-native-get-random-values

Expected Result

The wizard or the manual setup docs call out that a random number generator like react-native-get-random-values is a required peer dependency

Actual Result

Sentry.captureException calls fail silently, unless you wrap them in a try/catch which surfaces a "native module not found" exception, when digging into the stack trace it was looking for a random number generator like react-native-get-random-values

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions