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

Uncaught (in promise) Error: Cannot read properties of undefined (reading 'flags') #234

Closed
henriquekuwai opened this issue Jul 3, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@henriquekuwai
Copy link

henriquekuwai commented Jul 3, 2024

Hello,

I'm experiencing some intermittent console errors on my app, which is currently using the 4.0.2 version of flagsmith lib.

The error is shown below:
image

It is not something that really impacts the experience because the flags are correctly loaded, but is annoying because it is creating many error logs on our front-end monitoring service.

I reproduced the issue in a stackblitz app here: https://stackblitz.com/edit/stackblitz-starters-t4htj6?file=src%2FApp.tsx

And recorded a video with this behavior:

Screencast.from.03-07-2024.14.19.15.webm

When I change the identity of the user (using flagsmith.identify method) more than once in a short time, the console error appears. Note that when I change the identity slowly, it doesn't happen. At first, I thought that was something related to the cacheFlags parameter, but it happens even when it is disabled.

I've tested with React 17 and 18 using FlagsmithProvider, and with both versions, it happens.

If you need more information, please let me know.

Thanks!

@dabeeeenster dabeeeenster added the bug Something isn't working label Jul 3, 2024
@dabeeeenster
Copy link
Contributor

Thanks! We'll take a look.

@kyle-ssg
Copy link
Member

kyle-ssg commented Jul 3, 2024

Thanks for bringing this to our attention.

This occurred when the SDK gets a response from an identity that does not match the current. You're correct that it doesn't affect the correct flags loading.

The following PR will resolve this. In the meantime, 4.0.3-beta-1 resolves this too if you'd like to try it out. Thanks again!

@henriquekuwai
Copy link
Author

henriquekuwai commented Jul 3, 2024

Thanks for bringing this to our attention.

This occurred when the SDK gets a response from an identity that does not match the current. You're correct that it doesn't affect the correct flags loading.

The following PR will resolve this. In the meantime, 4.0.3-beta-1 resolves this too if you'd like to try it out. Thanks again!

It solved the problem here! Thank you 🚀

@kyle-ssg kyle-ssg closed this as completed Jul 3, 2024
@kyle-ssg kyle-ssg reopened this Jul 3, 2024
@kyle-ssg
Copy link
Member

kyle-ssg commented Jul 3, 2024

This is now released in version 4.0.3, thanks again!

@kyle-ssg kyle-ssg closed this as completed Jul 3, 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

4 participants