Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error "crypto.getRandomValues) not supported" in react-native application when using useVariant() in iOS simulator #223

Closed
Erwan-DATIN opened this issue Jul 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Erwan-DATIN
Copy link

Erwan-DATIN commented Jul 25, 2024

error "crypto.getRandomValues) not supported" in react-native application (0.71) in iOS simulator

Currently testing unleash and more precisely variants I encounter an error (does not occur in my testing web application):

crypto.getRandomValues) not supported

Steps to reproduce the bug

In a react-native application (my rn version is currently v0.71.x) useVariant()

import { useVariant } from '@unleash/proxy-client-react';
///....
const myVariant = useVariant('myVariant'); // will lead to this error in iOS simulator

Expected behavior

Should not throw this error

Logs, error output, etc.

See screenshot below.

Screenshots

image

Additional context

react-native 0.71+

Unleash version

@unleash/[email protected]

Subscription type

None

Hosting type

Hosted by Unleash

SDK information (language and version)

No response

@Erwan-DATIN Erwan-DATIN added the bug Something isn't working label Jul 25, 2024
@ivarconr
Copy link
Member

Easiest way to fix this for end-users would be to install and add import 'react-native-get-random-values' at the top of their React Native / Expo app, like mentioned here: https://www.npmjs.com/package/uuid#react-native--expo

(already discussed in #87)

@ivarconr ivarconr moved this from New to Support rotation in Issues and PRs Jul 29, 2024
@github-project-automation github-project-automation bot moved this from Support rotation to Done in Issues and PRs Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants