Hey Flipt folks!
I’m integrating Flipt in our FastAPI backend using gRPC. Everything works fine but I have a problem getting a boolean flag. I’m building a service class with a method similar to this:
def evaluate_bool(self, flag_key: str, entity_id: str) -> bool:
client = self.get_client() # This create a channel with an interceptor that inject the AuthToken, and return the Flipt Stub
response = client.Evaluate(
EvaluationRequest(
flag_key=flag_key,
entity_id=entity_id,
context={},
namespace_key=app_settings.FLIPT_NAMESPACE,
),
)
...
If the flag_key
is a variant, the response is expected depending on the entity_id
. But if the flag is a boolean, I’m getting this error:
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.INVALID_ARGUMENT
details = "flag type BOOLEAN_FLAG_TYPE invalid"
debug_error_string = "UNKNOWN:Error received from peer {created_time:"2024-09-11T13:55:10.76349593+00:00", grpc_status:3, grpc_message:"flag type BOOLEAN_FLAG_TYPE invalid"}"
This is my configuration:
version: "1.4"
namespace:
key: production
name: Production
flags:
- key: test-key
name: test-sync-edited
type: BOOLEAN_FLAG_TYPE
enabled: false
rollouts:
- segment:
key: internal-users
value: true
- key: another-thing
name: another-thing
type: VARIANT_FLAG_TYPE
enabled: true
variants:
- default: true
key: t1
- key: t2
rules:
- segment: internal-users
distributions:
- variant: t2
rollout: 100
- key: boolean-flag
name: Boolean Flag
type: BOOLEAN_FLAG_TYPE
enabled: false
segments:
- key: internal-users
name: internal-users
constraints:
- type: ENTITY_ID_COMPARISON_TYPE
property: entityId
operator: eq
value: leo.david
match_type: ALL_MATCH_TYPE
The flag that I’m using and getting the error is test-key
. I noticed that the enabled
field is False, but I can’t change it in the UI, I don’t see any button.
Flipt is a great platform! Thank you so much for building it!