launchdarkly / python-server-sdk

LaunchDarkly Server-side SDK for Python
https://docs.launchdarkly.com/sdk/server-side/python
Other
38 stars 45 forks source link

variation returns default value when client not initialized #279

Closed AmirPupko closed 6 months ago

AmirPupko commented 6 months ago

When calling 'variation' in some cases I get: "Feature Flag evaluation attempted before client has initialized! Feature store unavailable - returning default" Not sure what went wrong with the initialization, still, I expected an error to be raised instead of getting default value. Getting default value implies that everything went well and this key actually not exist, but this is not the case... Thanks!

keelerm84 commented 6 months ago

Good afternoon @AmirPupko!

This is intended behavior. The LaunchDarkly SDKs operate under the guideline of never throwing exceptions as it could negatively impact the customer's application. The documentation for the variation method notes that the default value will be returned if the flag is not available.

If you call the variation_detail method, you can inspect the returned EvaluationDetail object and check the reason for the evaluation yourself.

AmirPupko commented 6 months ago

Got it, thanks for the quick response!