configcat / js-sdk

ConfigCat SDK for JavaScript frontend applications. ConfigCat is a hosted feature flag service: https://configcat.com. Manage feature toggles across frontend, backend, mobile, desktop apps. Alternative to LaunchDarkly. Management app + feature flag SDKs.
https://configcat.com/docs/sdk-reference/js
MIT License
27 stars 10 forks source link

Failed to download feature flags & settings from ConfigCat. 0 #86

Closed szykov closed 10 months ago

szykov commented 1 year ago

Describe the bug

when user navigate between pages sometimes get this error: Failed to download feature flags & settings from ConfigCat. 0 -

should we destroy all configcat clients when the user refreshes the page/navigates from the page? for example on beforeunload event?

To reproduce

in theory you should reload the page in the moment when configcat updates flags

Expected behavior

no errors.

laliconfigcat commented 1 year ago

Hello @szykov ,

Thanks for reaching out. The expected usage of the ConfigCat JS SDK is to use it as a singleton during your application lifetime and dispose it at the end the application: https://configcat.com/docs/sdk-reference/js/#4-dispose-the-configcat-client .

Usually the 0 code means that the browser cannot send the request towards our CDN and the request doesn't even leave the browser - usually because of local network issues.

If you could share us more details about your usage we could help you further:

It would be awesome if you could turn on debug logging in the SDK (https://configcat.com/docs/sdk-reference/js/#setting-log-levels), and send the debug logs as well. Also, if you could reproduce the issue, please check the network tab to find more information why the http request could fail towards our CDN.

Cheers, Lali

szykov commented 12 months ago

Hello @laliconfigcat.

Thank you for the input. We plan to update configcat and investigate further. Now we use 6.0.1 version. We have an angular application and have our own singleton service where we initialize and store clients. We use auto polling and simply call getValue with the needed client.

I will get back to you if we find something else. It is really hard to trace what is the issue. Thanks.

laliconfigcat commented 10 months ago

Hello @szykov,

I'm closing this issue. If you still experience the issue, please open a new issue with the answers to my questions.

Cheers,

szykov commented 9 months ago

Please do. We have investigated it and the issue was on the client's side. Thank you.