Latest version of Unleash SDKs are incompatible with Gitlab Feature Flags
Synopsis
Unleash SDKs are removing the instanceId attribute from the configuration, and instead are auto-generating it.
This makes them incompatible with Gitlab Feature Flags.
Details
For instance, NodeSDK 6.0.0 does not allow providing instanceId, as therefore calls fail with
Unleash Repository error: https://gitlab.com/api/v4/feature_flags/unleash/{PROJECT_ID}/client/features responded 401 which means your API key is not allowed to connect. Stopping refresh of toggles
References
- Node client dropping the support for instanceId in the
6.0.0version. - Ruby client
- Dotnet client
Other SDKs are going to follow the same trend.
Possible Workarounds
It seems like it's possible to pass the instance id as a custom header.
For instance, the following works for me with unleash-node version 6.0.0
import {UnleashConfig} from "unleash-client"
const config: UnleashConfig =
{
url: "https://gitlab.com/api/v4/feature_flags/unleash/MY_PROJECT", // nonprod
appName: "YOUR_ENV)NAME",
customHeaders: {
"UNLEASH-INSTANCEID": "MY_INSTANCE_ID"
},
}
So if the Unleash team can verify that this is a reliable approach for the long-term, this will be a matter of updating the Gitlab Feature Flags docs to mention this pre-6.0.0 vs post-6.0.0 caveat (and likewise for other language SDKS, e.g. Java, Ruby)
Edited by Nader Ghanbari