simple-peer: Uncaught Error: Secure random number generation is not supported by this browser
Hello,
I really want to use this library but I receive the error below in the JS console when I try to make the first example working :
Uncaught Error: Secure random number generation is not supported by this browser. Use Chrome, Firefox or Internet Explorer 11
Tested on Firefox and Chrome, they are up to date of course.
I tried to use the simplepeer.min.js
standalone script directly in a <script> tag as well as the browserify method.
Thanks for your help.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 15 (4 by maintainers)
Hi @GagnDeep , I actually don’t remember what exactly I had done. I could fix the error with
crypto
but then I believe I got other errors from other node builtins that I did not manage to polyfill properly. In the end I gave up on usingsimple-peer
and implemented something based on https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Perfect_negotiation. I did not even save my experiments withsimple-peer
; I don’t have the code anymore. I am not that experienced with node and its ecosystem so rewriting stuff felt less frustrating than fixing packaging errors 🙃I have this error, I’m using react-native with expo-go, I’ve created a custom development build with
react-native-get-random-values
,crypto
,react-native-webcrypto
rn-nodeify
,events
,simple-peer
… Still getting this errorWARN Possible Unhandled Promise Rejection (id: 0): Error: Secure random number generation is not supported by this browser. Use Chrome, Firefox or Internet Explorer 11 Error: Secure random number generation is not supported by this browser. Use Chrome, Firefox or Internet Explorer 11 at oldBrowser (http://192.168.0.19:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&lazy=true:193688:20) at Peer (http://192.168.0.19:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&lazy=true:192672:30) at anonymous (http://192.168.0.19:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&lazy=true:187408:43) at apply (native) at anonymous (http://192.168.0.19:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&lazy=true:203012:27) at onconnect (http://192.168.0.19:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&lazy=true:204795:26) at onpacket (http://192.168.0.19:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&lazy=true:204678:29) at apply (native) at anonymous (http://192.168.0.19:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&lazy=true:203012:27) at anonymous (http://192.168.0.19:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&lazy=true:203969:30) at tryCallOne (/Users/distiller/react-native/packages/react-native/sdks/hermes/build_iphoneos/lib/InternalBytecode/InternalBytecode.js:53:16) at anonymous (/Users/distiller/react-native/packages/react-native/sdks/hermes/build_iphoneos/lib/InternalBytecode/InternalBytecode.js:139:27) at apply (native) at anonymous (http://192.168.0.19:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&lazy=true:39710:26) at _callTimer (http://192.168.0.19:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&lazy=true:39589:17) at _callReactNativeMicrotasksPass (http://192.168.0.19:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&lazy=true:39634:17) at callReactNativeMicrotasks (http://192.168.0.19:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&lazy=true:39840:44) at __callReactNativeMicrotasks (http://192.168.0.19:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&lazy=true:3643:46) at anonymous (http://192.168.0.19:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&lazy=true:3417:45) at __guard (http://192.168.0.19:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&lazy=true:3616:15) at flushedQueue (http://192.168.0.19:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&lazy=true:3416:21) at callFunctionReturnFlushedQueue (http://192.168.0.19:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&lazy=true:3401:33)