BSON: For React Native please polyfill crypto.getRandomValues
See original GitHub issueGoals
Regular use.
Expected Results
Regular use.
Actual Results
A warning started appearing after upgrading to Realm 10.4.0.
JSWarning
BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.
src/conf.js:594:34
node_modules/bson/dist/bson.browser.umd.js:2617:18 insecureRandomBytes
node_modules/bson/dist/bson.browser.umd.js:5182:40
node_modules/bson/dist/bson.browser.umd.js:14:9 createCommonjsModule
node_modules/bson/dist/bson.browser.umd.js:5175:37
node_modules/bson/dist/bson.browser.umd.js:2:72
node_modules/bson/dist/bson.browser.umd.js:5:2
node_modules/metro/src/lib/polyfills/require.js:322:6 loadModuleImplementation
node_modules/realm/lib/extensions.js:54:35
node_modules/realm/lib/index.js:64:24
node_modules/metro/src/lib/polyfills/require.js:322:6 loadModuleImplementation
src/db/index.js:8
Steps to Reproduce
Just use Realm (offline)
Code Sample
Version of Realm and Tooling
- Realm JS SDK Version: 10.4.0
- Node or React Native: React Native
- Client OS & Version: All
- Which debugger for React Native: None
Issue Analytics
- State:
- Created 2 years ago
- Comments:21 (8 by maintainers)
Top Results From Across the Web
react native - crypto.getRandomValues() not supported
Works fine on iOS. I solved it with: Uninstall the existing one npm uninstall react-native-webview; Use expo install react-native- ...
Read more >react-native-get-random-values - npm
A small implementation of crypto.getRandomValues for React Native. This is useful to polyfill for libraries like uuid that depend on it.
Read more >Can't resolve 'crypto' in node_modules/bson/dist react
I'm using realm-web on my react app to build a simple task reminder app. ... can't resolve 'crypto' in node_modules/bson/dist react.
Read more >bson - UNPKG
'BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.'.
Read more >polyfill-crypto.getrandomvalues examples - CodeSandbox
Learn how to use polyfill-crypto.getrandomvalues by viewing and forking polyfill-crypto.getrandomvalues example apps on CodeSandbox.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I put
import 'react-native-get-random-values'beforeimport Realmand the warning stopped.@xtianmpimbaza, nope, still haven’t found a way around it. In my case, it doesn’t prevent Realm writes though.
@kneth, any idea why those warnings are showing?