-
Notifications
You must be signed in to change notification settings - Fork 5
Uncaught TypeError: Cannot read property 'length' of undefined #22
Comments
I tried to use this lib with GitLab feature flags but initially I got the config wrong, like this:
For some reason unknown to me, GitLab has decided this endpoint should return |
@yangm97 Thanks for reporting! |
@fvoordeckers hey thanks for the lib! Yes, the config was wrong indeed but I opened this issue because it looks like fetchFlags() is not type safe.
Will happily decode a body of We could either add a plain type check there or do a schema validation on the whole response object. Maybe we need an error boundary regardless, what you think? |
Indeed, good idea to add some type checking there and add a check if the configuration was valid to do the call. The library should throw an error instead of handling a 200. |
@yangm97 Could you elaborate on the "config change" you applied to get it working. Running into the same issue with GitLab. If it is something more people encounter, we could elaborate on the issue in the documentation. |
@woutderooms you need to leave
|
react-unleash-flags/src/hooks/useFlag.ts
Line 15 in a8597e4
When
uri
returns200 OK
with a plain text body instead of a proper flags json.The text was updated successfully, but these errors were encountered: