Environment
- roslib version: 2.x (latest)
- Platform: React Native (Expo Bare)
- JS engine: Hermes
- OS: Android (also reproducible on iOS with Hermes)
- Transport: rosbridge WebSocket
Description
After upgrading from roslib 1.4.1 to 2.x, the app crashes at startup in a React Native environment using Hermes. The error appears to originate from dependencies (likely BSON / Buffer usage) that rely on encodings unsupported by Hermes.
Error Logs
WARN BSON: For React Native please polyfill crypto.getRandomValues
ERROR RangeError: Unknown encoding: latin1 (normalized: latin1), js engine: hermes
Steps to Reproduce
- Create a React Native project (Expo Bare or CLI).
- Enable Hermes (default in recent RN versions).
- Install roslib 2.x:
- Import and create a Ros instance:
import { Ros } from 'roslib'
const ros = new Ros({
url: 'ws://localhost:9090'
})
- Run on Android or iOS.
Expected Behavior
roslib should initialize normally in React Native, or documentation should clarify that RN is not supported.
Actual Behavior
Application crashes with:
RangeError: Unknown encoding: latin1
Questions
- Is React Native (Hermes) officially supported in roslib v2?
- Are there recommended polyfills or configuration steps to make v2 work in RN?
- If RN is not supported, would it be possible to document this limitation?
- Is there any plan to provide a RN-compatible build (without Node-specific encoding dependencies)?
Thank you!
Environment
Description
After upgrading from roslib 1.4.1 to 2.x, the app crashes at startup in a React Native environment using Hermes. The error appears to originate from dependencies (likely BSON / Buffer usage) that rely on encodings unsupported by Hermes.
Error Logs
Steps to Reproduce
Expected Behavior
roslib should initialize normally in React Native, or documentation should clarify that RN is not supported.
Actual Behavior
Application crashes with:
Questions
Thank you!