Unleash / unleash-proxy-client-js

A browser client that can be used together with the unleash-proxy.
Apache License 2.0
44 stars 46 forks source link

Unleash: unable to fetch feature toggles TypeError: XXXX #182

Closed voratham closed 7 months ago

voratham commented 7 months ago

Describe the bug

Currently i used unleash-client-proxry-js with vue2 js and i used sentry for monitoring error

I found some error that I cannot reproduce ?

  1. Unleash: unable to fetch feature toggles TypeError: Load failed

    • Observation I found sentry-platform found on IOS many by not found android browser.
  2. Unleash: unable to fetch feature toggles TypeError: Failed to fetch

    • Observation I found sentry-platform found on Android many by not found safari browser.

my application start unleash by example code below

const startApp = async () => {
  try {
    await unleash.start()
  } finally {
    new Vue({
      apolloProvider,
      router,
      store,
      render: h => h(App)
    }).$mount('#app')
  }
}
startApp()

Steps to reproduce the bug

  1. Go to web-browser
  2. used network console blocking domain unleash (but on real use case i cannot reproduce) but i found error 2,000 - 11,000
  3. found error on console

Expected behavior

No response

Logs, error output, etc.

No response

Screenshots

No response

Additional context

No response

Unleash version

3.1.0

Subscription type

Open source

Hosting type

Self-hosted

SDK information (language and version)

No response

kwasniew commented 7 months ago

Hey @voratham. Can you give us more details about the server-side of your Unleash setup? Are you using proxy, edge or frontend API? What version are they? Have you made any upgrades recently when the error reporting started?

voratham commented 7 months ago

ok i list detail by i used on kubernetes

image
unleashorg/unleash-server:4.10.5
unleashorg/unleash-proxy:0.8.1

for my vue app i have 2 application

app1
unleash-proxy-client 3.1.0
app2
unleash-proxy-client 1.11.0

by app1 i expected upgrade library it will solve my probelm but not work

kwasniew commented 7 months ago

unleash-proxy:0.8.1 is 2 year old version. Is it possible to upgrade it to the latest one?

voratham commented 7 months ago

@kwasniew Thankyou i tried to talk to my team but I consider code below it happed in case disconnect ? Is it possible that unleash-proxry-client init couldn't keep up? https://github.com/Unleash/unleash-proxy-client-js/blob/main/src/index.ts#L405-L406

kwasniew commented 7 months ago

The error you're seeing is probably from line 411: https://github.com/Unleash/unleash-proxy-client-js/blob/main/src/index.ts#L411C16-L411C16 This error means that you send HTTP request but the response never arrived. In this case we do: console.error('Unleash: unable to fetch feature toggles', e); https://github.com/Unleash/unleash-proxy-client-js/blob/bac049d8ec641bc7c2f194a3e65add705b0b6ba4/src/index.ts#L437C17-L437C78 which you're seeing in sentry. There's a few reasons it may happen but the most typical case is there's a network connection problem. Someone using a mobile device goes offline. Or someone with a slow connection times out their request.

kwasniew commented 7 months ago

Here's a video explaining that with users going offline or requests being blocked by the browser you'll see those errors:

https://github.com/Unleash/unleash-proxy-client-js/assets/1394682/3d53c6fe-4bce-4167-a6f5-1b8eedb254ce

voratham commented 7 months ago

unleash-proxy:0.8.1 is 2 year old version. Is it possible to upgrade it to the latest one?

I have some question i should upgrade unleash-servser same? it will breaking change or not ?

kwasniew commented 7 months ago

unleash-proxy:0.8.1 is 2 year old version. Is it possible to upgrade it to the latest one?

I have some question i should upgrade unleash-servser same? it will breaking change or not ?

You can upgrade proxy separately from the unleash-server. However to benefit from all the improvements (security patches, product enhancements, bug fixes) that we're making every day I'd recommend to also upgrade unleash-server. Here's a detailed info about upgrade: https://docs.getunleash.io/using-unleash/deploy/upgrading-unleash. From the SDK perspective there are no breaking changes.