Unleash/unleash-proxy-client-js

[React-Native] triggers uuid crash when feature with impression data enabled is used with `isEnabled`

Kei-Neurio opened this issue Β· 4 comments

Describe the bug

Hi! It's a really specific issue. when a certain word is used for key and run isEnabled() with it, it causes a crash bug which is coming from uuid library. I know that it's a known issue with v4 uuid and there's a monkey patch fix for it, but I figured it's confusing for ones who are not familiar/new to React Native. I have no idea why that particular word triggers this behavior... but I hope this report helps someone come across the same issue. I fixed it by changing the word to pwd but I have a feeling that there are more keywords that triggers this issue.

The straightforward fix for this issue would be installing react-native-get-random-values but it doesn't feel right to bring it only for React Native since this library is for other frameworks too.

dependencies:

"unleash-proxy-client": "1.11.0",
"react-native": "0.66.3",
"react": "17.0.2",

Steps to reproduce the bug

  1. Create a key in unleash that contains the word "password"(e.g. [your-product-name].change-password.enable-screen)
  2. Enable the feature in your unleash console
  3. In your app, trigger isEnabled() function with the key just created

Expected behavior

isEnabled() should return true value.

Logs, error output, etc.

No response

Screenshots

Additional context

No response

Unleash version

1.11.0

Subscription type

Enterprise

Hosting type

No response

SDK information (language and version)

No response

Hey, thank you for bringing this to our attention. I will raise the issue with the team.

Hi @Kei-Neurio thanks for opening this issue and providing detailed information.

From our tests reproducing the bug it seems like this may not be name-related, but instead impression-data-related. We had no issues with password-named feature toggles, but we did have this issue with features that had impression data enabled.

Can you please confirm this? This can be easily changed in Unleash by going to the specific Feature Toggle > Settings > Feature information (edit) > Enable impression data toggle.

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


My suggestion, however, would be to have a specific proxy-client-react-native package, extremely similar to proxy-client-react but with any specific React Native / Expo caveats built-in, providing more of a plug and play experience for end-users.

Here's a quick PoC: proxy-client-react-native

I'll check with the rest of the team on the best way forward regarding this and will let you know πŸ™‚

Thank you for the quick response and diagnosis @nunogois! I'll check the impression data toggle and post the result here. Just checked proxy-client-react-native and it's an exciting addition to the project. Looking forward to the update!

[update] Yes you are right, it was caused because we had the impression toggle onπŸ‘ I'll leave this issue until some fix goes in place but feel free to close it if you wanted!

Hey @Kei-Neurio - Thanks for confirming this!
Our decision for now was to add this React Native/Expo SDK PoC to our Community SDK list here: https://docs.getunleash.io/sdks#community-sdks
If we see it gains traction, we'll probably give more attention to it and promote it to an official SDK. In the meantime, for anyone not using it, there's still the workaround mentioned above.

We'll close this issue for now, but please feel free to reach out to us at anytime πŸ™‚