Skip to content

FCE-3336: Emit error if react-native-get-random-values is missing#540

Merged
MiloszFilimowski merged 2 commits into
mainfrom
mfilimowski/FCE-3336-get-random-values-warning
May 22, 2026
Merged

FCE-3336: Emit error if react-native-get-random-values is missing#540
MiloszFilimowski merged 2 commits into
mainfrom
mfilimowski/FCE-3336-get-random-values-warning

Conversation

@MiloszFilimowski

Copy link
Copy Markdown
Collaborator

Description

  • Add assertReactNativeWebrtcNativeModule check that verifies NativeModules.WebRTCModule is linked and throws an actionable error with install/rebuild steps when missing.
  • Add assertGetRandomValuesPolyfill check that verifies globalThis.crypto.getRandomValues works and throws an actionable error pointing to react-native-get-random-values when missing.
  • Run both assertions after registerGlobalsPolyfill() in packages/mobile-client/src/webrtc-polyfill.ts.

Motivation and Context

Surface a clear, actionable error at startup when required native dependencies are missing or not linked, instead of letting the SDK fail later with cryptic runtime errors.

Documentation impact

  • Documentation update required
  • Documentation updated in another PR
  • No documentation update required

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to
    not work as expected)

@MiloszFilimowski MiloszFilimowski requested a review from Copilot May 22, 2026 10:24
@linear

linear Bot commented May 22, 2026

Copy link
Copy Markdown

FCE-3336

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds early startup assertions in the React Native client to surface actionable errors when required native dependencies (WebRTC native module and crypto.getRandomValues polyfill) are missing or not linked, avoiding later/cryptic runtime failures.

Changes:

  • Added a runtime assertion to verify NativeModules.WebRTCModule is present and throw an install/rebuild guidance error if not.
  • Added a runtime assertion to verify globalThis.crypto.getRandomValues is functional and throw an error pointing to react-native-get-random-values if not.
  • Invoked both assertions immediately after the existing registerGlobalsPolyfill() initialization.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/mobile-client/src/webrtc-polyfill.ts Outdated
Comment thread packages/mobile-client/src/webrtc-polyfill.ts
Comment thread packages/mobile-client/src/webrtc-polyfill.ts
@MiloszFilimowski MiloszFilimowski force-pushed the mfilimowski/FCE-3336-get-random-values-warning branch from 6c3d24e to 1b56b65 Compare May 22, 2026 10:54
@MiloszFilimowski MiloszFilimowski merged commit 5fba6f1 into main May 22, 2026
2 checks passed
@MiloszFilimowski MiloszFilimowski deleted the mfilimowski/FCE-3336-get-random-values-warning branch May 22, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants