Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segments not working with EXP_SERVER_SIDE_SDK_CONFIG_TOKENS #201

Closed
rossipedia opened this issue Nov 24, 2024 · 1 comment
Closed

Segments not working with EXP_SERVER_SIDE_SDK_CONFIG_TOKENS #201

rossipedia opened this issue Nov 24, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@rossipedia
Copy link

rossipedia commented Nov 24, 2024

Describe the bug

/proxy/client/features does not include segment information when requested by a client using one of the keys configured in EXP_SERVER_SIDE_SDK_CONFIG_TOKENS. This leads to unleash-client-node and unleash-client-go (and others I assume) to return invalid isEnabled() checks for features that have been assigned segments, when those clients connect to a proxy instead of an unleash-server instance.

Steps to reproduce the bug

  1. In your Unleash instance, create a Segment constraint
  2. Create a Feature and assign that Segment to it
  3. Configure unleash-proxy with EXP_SERVER_SIDE_SDK_CONFIG_TOKENS
  4. Configure an unleash-client-node instance to connect to the proxy URL instead of an unleash-server /api URL
  5. Check the feature with context that should satisfy the segment constraint.

This will return false for the isEnabled() check.

Expected behavior

isEnabled() should return true when passing a context that satisfies the Segment constraint.

If you connect the unleash-client directly to the unleash-server instance (using a Client API Token), then it will return true as expected.

Logs, error output, etc.

I created a minimal reproduction of this issue here:

https://github.com/rossipedia/unleash-proxy-segment-bug

Screenshots

image

Additional context

I traced this down to the unleashApi method of the UnleashProxy class (here), which ultimately calls repository.getToggles(). Even if getTogglesWithSegmentData() were called, that method inlines the segment constraints into the feature definitions, rather than preserving the format of the initial /api/client/features response, which is what a consuming client expects.

Ideally, the response from /proxy/client/features when served from an unleash-proxy instance should be identical to the one that returns from /api/client/features when requested from an unleash-server instance.

I have verified the same broken behavior exists when using unleash-client-go, which gives the following debug output when connecting to unleash-proxy using EXP_SERVER_SIDE_SDK_CONFIG_TOKENS:

ERROR: segment does not exist

Note

unleash-edge does not exhibit this behavior. I believe updating unleash-proxy is still worthwhile though, as some consumers may not be able to easily migrate off of unleash-proxy.

Unleash version

Latest

Subscription type

Enterprise

Hosting type

Hosted by Unleash

SDK information (language and version)

unleash-proxy, latest version

@rossipedia rossipedia added the bug Something isn't working label Nov 24, 2024
@FredrikOseberg FredrikOseberg self-assigned this Nov 26, 2024
@FredrikOseberg
Copy link
Contributor

Hi @rossipedia

This repository is currently in maintenance mode and will not receive further development other than security patches going
forward. Unfortunately we will not continue development or fix experimental features here.

We've developed unleash-edge to be the successor to the unleash-proxy, so we recommend you use edge instead to handle your traffic.

@github-project-automation github-project-automation bot moved this from Investigating to Done in Issues and PRs Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

2 participants