flagsmith-js-client
flagsmith-js-client copied to clipboard
Add error condition for missing environmentID and api fields
In order to validate if FLAGSMITH ON FLAGSMITH failed we need to add a validation for both environmentID and api fields and throw an error in case they're not set
Issues we need to solve:
Flagsmith frontend
- On SDK initialization error, the fallback screen is Maintenance Mode, no matter the error:
- We should give access to the dashboard with default flags (similar to flags not created in the FoF instance)
- We show a warning that the SDK has not been properly initialized
- Be more specific on the SDK Error
Steps to reproduce:
- Empty FoF (environmentID is empty and api is empty)
- Infinite loading: If environmentID and FoF are provided but wrong, the SDK doesn't raise an error and
onChangeis never triggered. Which should cascade tostore.loadedand give access to the app.
- In the frontend, we should add a fallback path (in case of FoF) to consider that initialization failed
- Would give access to the dashboard with default flags and warning
Steps to reproduce:
- Provide FoF URL and corrupt the environmentID key
SDK We don't raise errors on invalid credentials when initializing the SDK for exemple. So the SDK is initialized and the following calls throw errors on specific methods that are not handled. We need to better handle the following errors:
- 404 => Wrong FoF URL (potential permanent issue, misconfiguration or server temporary down)
- 403 => Correct URL but wrong Key (configuration issue)
Potential solution could be that for FoF, the SDK pings the server with the credentials to validate them
@tiagoapolo @kyle-ssg
To be replaced with #324