alert-cpu-29682
08/19/2024, 2:44 AMhappy-autumn-40938
08/19/2024, 4:17 AMgb.setAttributes()
rather than in the SDK constructor. Basically it will fail to load sticky buckets for anything other than the primary hash attribute "id" unless its fed into the constructor. When possible, its probably best to pass attributes directly into the constructor.
2. This is now patched in our repo; however we have not yet published the changes to NPM. Basically you caught this bug between deploys. The NPM publish will probably go out on Monday or Tuesday.alert-cpu-29682
08/19/2024, 8:24 AMalert-cpu-29682
08/20/2024, 11:44 PMhappy-autumn-40938
08/21/2024, 12:10 AMhappy-autumn-40938
08/21/2024, 4:56 AMLocalStorageStickyBucketService
and am observing the opposite:
No overlap between attributes (base case):
1. localStorage.clear()
- clean slate
2. Eval using id
(hash attribute) alone returns "*control*". id
SB doc written to LS.
3. Eval using deviceId
(fallback attribute) alone returns "*variant*". deviceId
SB doc written to LS.
Moving from fallback to hash attribute (your scenario):
1. localStorage.clear()
- clean slate
2. Eval using deviceId
returns "*variant*". deviceId
SB doc written to LS.
3. Eval using deviceId
AND id
returns "*variant*". id
SB doc written to LS.
4. Eval using only id
returns "*variant*".
I did notice a few peculiar things in your codebase and wonder if these have any effect:
• You're fetching the features portion of the SDK payload outside of the SDK and injecting that after constructor.
◦ Typically we advice that you let the SDK do the fetching itself as it handles caching for you. gb.init()
kicks off fetching the SDK payload or pulling it from SDK cache.
• You're calling gb.setFeatures(json.features)
which isn't really the proper way of hydrating your SDK.
◦ Ideally use gb.init()
as setFeatures() is deprecated.
◦ If you must do your own SDK payload hydration, use gb.init({ payload: json })
(where json
is the manually fetched SDK payload).
• For a bit more debugging info you can use debug: true
in the constructor (or just set gb.debug = true
after construction).
That said, I tried to mimic your set up and still am observing correct sticky bucket behavior. Maybe try double checking your implementation based on the above suggestions, and if not send me a message and we can try to debug a bit more.alert-cpu-29682
08/21/2024, 4:58 AM