Date of slack thread: 8/11/24
Anonymous: Whenever I have an issue with Statsig, typically a flag not working, I’m unsure how to troubleshoot. Using your React SDK, I can see the reason the flag is not working is Error. I would really love to know the nature of the error whenever one exists. How can I get that information?
Anonymous: Looking at the linked doc, every time I’ve had a hair-pulling experience with Statsig, I’m getting Reason: Error. According to the docs there’s not much else to do but pull more hair. Statsig is great when it works, and makes me want to promptly remove it from my stack when it doesn’t. It’s the only thing in my stack that I feel this way about, I’m not a rager lol. It’s the experience of staring at something that I followed instructions to use, and it just doesn’t work, and there’s no real recourse. Hopefully this is somewhat useful feedback. Unknown error should be limited to an unexpected 500 on Statsig’s side. I need info if I’m going to fix my problem.
Vijaye (Statsig): Appreciate the feedback, Shawn. We will debug and see what more detail we could share in this situation. For the specific issue, could you share more of your implementation detail, so we can help you in the right direction? The initialize code, user object, etc?
Anonymous: It’s a react native project, and I’m trying to use a flag before the user is authenticated via stable id. My other flags using user id still work fine, so initialization isn’t failing. The stable id flag just isn’t working.
Statsig initialization:
const client = useMemo(() => {
const instance = new StatsigClient(
STATSIG_CLIENT_KEY,
{},
{
environment: { tier: NODE_ENV },
},
)
instance.initializeAsync()
return instance
}, [])
useEffect(() => {
if (!user) {
return
}
client.updateUserAsync({ userID: user._id, email: user.email })
}, [user])
const warming = warmCachingFromAsyncStorage(client)
return (
<StatsigProviderExpo client={client} cacheWarming={warming}>
{children}
</StatsigProviderExpo>
)
Anonymous: For the flag itself I’m just using useGateValue()
. The name is correct, quadruple checked that, and then copy-pasted from the dashboard for good measure.
Anonymous: Flag in question is auth_diagnostics
.
Vijaye (Statsig): <@U01RAN2FKJP> could you pls take a look here?