Unleash / unleash-edge

MIT License
48 stars 8 forks source link

Unleash edge - multiple project with same flag name is not returning flags for frontend api #468

Closed Sandhyasr20 closed 1 month ago

Sandhyasr20 commented 4 months ago

Describe the bug

We have unleash edge running with 2 projects.Both projects have same flags. When frontend api is invoked we see 0 toggles

Steps to reproduce the bug

1.Create project1 with name flag1 , enabled 2.Create project2 with name flag1, enabled 3.Unleash edge running with edge token created for project1 and project2 4.Create frontend token for project1 and project2 Invoke frontend API for project1 with authorized frontend token {"toggles":[]} Invoke frontend API for project2 with authorized frontend token Returns flag1

Expected behavior

Invoke frontend API for project1 with authorized frontend token Return flag1 Invoke frontend API for project2 with authorized frontend token Returns flag1

Logs, error output, etc.

There are no unleash edge errors for this.
But easily reproducible using offline mode.
We have json created(using client/features and valid client token) for both projects. 
Run unleash in offline mode and invoke frontend api
frontend/all api also returns 0 flags

We used curl command for testing, not used any frontend sdk.

Note:
client/features API returns all the flags. 
Frontend API call to unleash endpoint directly also returns all the flag
This is specific to using frontend api for unleashedge

Screenshots

No response

Additional context

No response

Unleash version

Tried docker unleash-edge:latest

Subscription type

Open source

Hosting type

Self-hosted

SDK information (language and version)

No response

chriswk commented 4 months ago

Feature flag names must be unique across the Unleash Instance, not just inside a project. How did you manage to create two flags with the same name?

makunterry commented 4 months ago

@chriswk There is scope/project concept in unleash and the authentication is seperate by scope, my understanding is that the feature flag names should be seperate by scope as well in most cases.

chriswk commented 4 months ago

Nope. Feature flag names are globally unique. We're firm believers in https://docs.getunleash.io/topics/feature-flags/unique-names and Unleash enforces this at the top level. You should not be able to create two features with the same name, there's a UNIQUE constraint in the database on the feature_name column.

Sandhyasr20 commented 4 months ago

Thanks @chriswk looks our unleash server code base to have duplicate flags for some other requirements and client/features API works perfectly fine.Unfortunately frontend APIs are not working as expected. You can close this ticket