UnleashProxy no longer works with GitLab feature flags

Summary

With version 6 of the unleash client, the instanceId field has been removed and is now automatically generated. Since version 1.4.1, the Unleash proxy has no longer worked with GitLab, leading to an error.

Error: 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

Steps to reproduce

Start the latest version of the unleash-proxy server

docker run \
   -e UNLEASH_PROXY_CLIENT_KEYS=123 \
   -e UNLEASH_URL=https://gitlab.com/api/v4/feature_flags/unleash/{PROJECT_ID}\
   -e UNLEASH_INSTANCE_ID={INSTANCE_ID}\
   -e UNLEASH_API_TOKEN=token1234 \
   -e UNLEASH_APP_NAME=test\
   -e LOG_LEVEL="debug" \
   -p 3000:3000 \
   --rm unleashorg/unleash-proxy

What is the current bug behavior?

The started container will be unhealthy, and the proxy won't work.

What is the expected correct behavior?

The unleash proxy server can connect to GitLab and fetch the feature flag configuration. Currently, GitLab requires a match with the header UNLEASH-INSTANCEID

curl --header "UNLEASH-INSTANCEID: {INSTANCE_ID}" "https://gitlab.com/api/v4/feature_flags/unleash/{PROJECT_ID}"

However, since version 6.0.0 of the unleash-client, the instanceId is automatically generated and cannot be specified as an env variable.

Immediate Workaround

The fastest fix for the one having the same error is to use the unleash-proxy version 1.4.0

dodocker run \
   -e UNLEASH_PROXY_CLIENT_KEYS=123 \
   -e UNLEASH_URL=https://gitlab.com/api/v4/feature_flags/unleash/{PROJECT_ID}\
   -e UNLEASH_INSTANCE_ID={INSTANCE_ID}\
   -e UNLEASH_API_TOKEN=212 \
   -e UNLEASH_APP_NAME=test\
   -p 3000:3000 \
   --rm unleashorg/unleash-proxy:1.4.0

GitLab feature flag documentation should be updated accordingly.

Edited by Gianlorenzo Occhipinti