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

UNLEASH EDGE DAISY CHAIN ISSUE #463

Open
pi194046 opened this issue May 15, 2024 · 7 comments · May be fixed by #465
Open

UNLEASH EDGE DAISY CHAIN ISSUE #463

pi194046 opened this issue May 15, 2024 · 7 comments · May be fixed by #465
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@pi194046
Copy link

Describe the bug

i created a unleash edge running in offline mode at port 3064
I created a unleash edge running in edge mode at port 3063 pointing to uleash edge offline instance port 3064

when I testing using the token and curl request , I am able to successfully make the API call on offline instance at port 3064 but using the same token on port 3063 is giving 403 Forbidden ie token is invalid

If I use the same approach and have unleash server running at port 4242, and I create a unleash edge running in edge mode at pointing to unleash server then the curl request is successful at both 4242 and port 3063

I had used the same token created on unleash server while configuring the unleash offline instance

Steps to reproduce the bug

Run the below command in one terminal
docker run --rm -e RUST_LOG="trace,unleash_edge=trace" -v pwd/config:/tmp/config -p 3064:3063 unleashorg/unleash-edge offline -b /tmp/config/a.file -r 2 -t 'default:development.40df9a2423b500ad80b53f3f97153af8f6768df483e09aa712345678'

please the a.file in the location in the config folder in the current directory

Run the below command in another terminal
docker run -p 3063:3063 -e RUST_LOG="trace,unleash_edge=trace" --rm unleashorg/unleash-edge edge -u http://your-domain.com:3064 -t 'default:development.40df9a2423b500ad80b53f3f97153af8f6768df483e09aa712345678' -f 10 --token-revalidation-interval-seconds 10

the below call is successful
curl -X GET http://your-domain.com:3064/api/client/features -H 'Accept: application/json' -H 'Authorization: default:development.40df9a2423b500ad80b53f3f97153af8f6768df483e09aa712345678' -v

the below call is a failure
curl -X GET http://your-domain.com:3063/api/client/features -H 'Accept: application/json' -H 'Authorization: default:development.40df9a2423b500ad80b53f3f97153af8f6768df483e09aa712345678' -v

Expected behavior

daily chaining unleash edge instances with edge instances pointing to an offline instance should work properly

Logs, error output, etc.

No response

Screenshots

No response

Additional context

No response

Unleash version

No response

Subscription type

None

Hosting type

Self-hosted

SDK information (language and version)

No response

@pi194046 pi194046 added the bug Something isn't working label May 15, 2024
@chriswk chriswk transferred this issue from Unleash/unleash May 15, 2024
@chriswk chriswk self-assigned this May 15, 2024
@chriswk
Copy link
Contributor

chriswk commented May 15, 2024

I moved this issue to Unleash-edge rather than the Unleash repo.

I can confirm this is correct. This is due to supporting multiple types of tokens, when Edge in offline mode is the endpoint for validating a token, it does not return the token type, and as such edge in daisy chain mode with the offline node as the terminus does not know that it can use the token (which was validated) to sync features. It relates back to being able to define both client and frontend tokens for edge in offline mode.

@chriswk chriswk added the enhancement New feature or request label May 15, 2024
@chriswk
Copy link
Contributor

chriswk commented May 15, 2024

An initial solution here would be to go into the validator endpoint and if we have no validator, assume all tokens we know about are client tokens. That would solve this for the short term, but would make it even harder to deal with ways of adding both client and frontend tokens to offline mode.

@chriswk
Copy link
Contributor

chriswk commented May 15, 2024

I think the best approach here is to add
--frontend-tokens <token1>,<token2>
--client-tokens <token3>,<token4>
and keep the current behaviour for --tokens when in offline mode

@sighphyre
Copy link
Member

@pi194046 Can I ask what you're trying to do here? To be honest, at the moment I'm leaning towards making daisy chaining against an offline instance an explicit failure rather

@ivarconr
Copy link
Member

I agree with @sighphyre here. I do not understand the use-case to daisy chain in offline mode, you should rather just horizontally chain.

@pi194046
Copy link
Author

pi194046 commented May 16, 2024 via email

@sighphyre
Copy link
Member

Okay I think what you're trying to do make a lot of sense but I don't think daisy chaining Edge instances against an offline instance is the best way to solve that. Offline Edge has a lot of limitations with the way it handles tokens and responses, even without the limitation you're raising here.

My suggestion would probably be to run all the Edge instances you need in offline mode and rather distribute the file you need to each of those instances

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

4 participants