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
Client does not return flags - self hosted api server #3
Comments
Can you confirm this is due to using a self hosted api? I feel like this is a duplicate of #2 |
It,s not duplicate of #2 , here, I'm loading the client from the CDN (https://cdn.jsdelivr.net/npm/bullet-train-client/lib/index.js) and it loads and connect to the API server properly. The client does receive a response from the API server that contains the feature flag, but the |
The code seems wrong, in bullet-train-core, this calls the handleResponse(res) function, the response from the API is an array: https://github.com/SolidStateGroup/bullet-train-js-client/blob/f96cb36aabc8e77dabf790e36b78dbc9f898ec45/bullet-train-core.js#L65 But the For reference, the bullet-train-fronend app interpret the response from the API as an array: https://github.com/SolidStateGroup/bullet-train-frontend/blob/e062cfd406e85c0220c2759556129a0776ae9975/web/components/TryIt.js#L22 |
Here is the commit that switch the handling from an array to an object: 5c131e0 |
The response from getting flags is not an array since implementing user traits it is an object. Are you sure your API is set up correctly and you are using the latest version?
|
To demonstrate this, there's a super simple react app that lets you retrieve flags+traits and toggle a user trait. |
Looks like my api server is not up to date. It's a bummer that the api changes in incompatible ways like that. |
Now i'm running that latest api server from github and I still get an array
response:
|
The bug is when you would call |
bullet-train-client and react-native-bullet-train have been updated to 0.0.42 to incorporate this. |
I initialized the client with :
In the console (from the handleFlag listener) I get :
{}, {isFromServer: true}, {}
The response I get from the API server is :
if I call
bulletTrain.hasFeature("hello_world")
I always getfalse
.The text was updated successfully, but these errors were encountered: