All features are in status OFF
Closed this issue · 11 comments
When querying the GrowthBook SDK for the value of a specific feature key and the feature is active in the GrowthBook console, the returned status for this feature is OFF.
growthBookSDK.feature("flag_key").on == false
When retrieving the list of features, it results in an empty list:
growthBookSDK.getFeatures().size == 0
Scenarios and Preconditions to Reproduce the Issues:
Scenario 1:
- SDK Payload Security: Ciphered
- Version used: 1.1.36, 1.1.43 and 1.1.51 (latest)
Result:
- The issue can be reproduced in 100% of the cases.
Scenario 2:
- SDK Payload Security: Plain Text
- Version used: 1.1.36, 1.1.43
- networkDispatcher =
DefaultGBNetworkClient
Result:
- The issue occurs the first time values are fetched from the SDK. Subsequent fetches retrieve the correct information.
Scenario 3:
- SDK Payload Security: Plain Text
- Version used: 1.1.51 (latest)
- networkDispatcher =
DefaultGBNetworkClient
- Additional Requirement: Ktor dependencies must be added (not mentioned in the documentation but necessary for compilation)
Result:
- The issue can be reproduced in 100% of the cases.
SDK Initialization
1.1.36 version
GBSDKBuilder(
apiKey = BuildConfig.GB_APIKEY,
hostURL = BuildConfig.GB_HOSTURL,
attributes = mapOf(),
encryptionKey = BuildConfig.GB_ENCRYPTKEY,
trackingCallback = { _, _ -> }
).initialize()
1.1.43 version
GBSDKBuilder(
apiKey = BuildConfig.GB_APIKEY,
hostURL = BuildConfig.GB_HOSTURL,
attributes = mapOf(),
encryptionKey = BuildConfig.GB_ENCRYPTKEY,
trackingCallback = { _, _ -> },
networkDispatcher = DefaultGBNetworkClient()
).initialize()
1.1.51 version
GBSDKBuilder(
apiKey = BuildConfig.GB_APIKEY,
hostURL = BuildConfig.GB_HOSTURL,
attributes = mapOf(),
encryptionKey = BuildConfig.GB_ENCRYPTKEY,
trackingCallback = { _, _ -> },
networkDispatcher = DefaultGBNetworkClient(),
remoteEval = true
).initialize()
can someone support me to try to fix the issue?
Are you accessing the features right after?
GBSDKBuilder(
apiKey = BuildConfig.GB_APIKEY,
hostURL = BuildConfig.GB_HOSTURL,
attributes = mapOf(),
encryptionKey = BuildConfig.GB_ENCRYPTKEY,
trackingCallback = { _, _ -> },
networkDispatcher = DefaultGBNetworkClient(),
remoteEval = true
).initialize()
Is the same with ?
remoteEval = false
I have an SSL exception with remoteEval = false
But now I have more info. Tested in 1.1.43 version
Further investigation revealed that the SDK is unable to process queries during the initial seconds after the app launches. The issue is reproducible when a query is executed in the first Acticity
at the beginning (the first thing that I execute in onCreate).
However, if I introduce a delay of 2 seconds before running the query, it successfully retrieves the feature with the correct data.
Sure. The SDK needs to have a small period of time to get Features from Backend. The SDK needs it only for the first time. After first initialization features are stored in cache and should be accessible immediately on the second time.
is it possible to add a callback to indicate when is ready the SDK? Otherwise, it's impossible to know when the SDK is ready
We already have such a callback. It is GBCacheRefreshHandler
. We expect users to pass implementation of this callback through setRefreshHandler()
method in GBSDKBuilder
class.
setRefreshHandler()
works good for me
@Antoniorihu Have you tried setRefreshHandler()
?
Sorry, I could not try, I need to fix an important fix to production. However, I'll try this afternoon and respond as soon as possible. It seems to be what I need.
ok, I tested and works fine for me too.
Thanks for the support!