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

[BUG] Keyring errors when intialising flyte remote client #4354

Open
2 tasks done
Tom-Newton opened this issue Nov 2, 2023 · 5 comments
Open
2 tasks done

[BUG] Keyring errors when intialising flyte remote client #4354

Tom-Newton opened this issue Nov 2, 2023 · 5 comments
Assignees
Labels
bug Something isn't working flytekit FlyteKit Python related issue good first issue Good for newcomers

Comments

@Tom-Newton
Copy link
Contributor

Tom-Newton commented Nov 2, 2023

Describe the bug

Get a keyring error when initialising a simple flyte remote client. It seems to only happen on some systems and the exact error varies slightly. I've seen
InitError: Failed to create the collection: Prompt dismissed..
KeyringLocked: Failed to unlock the collection!

Expected behavior

I'm not trying to use any authentication so I would expect it to ignore any exceptions about the system keyring. Alternatively we could add AuthType.NONE so that all keyvault related code can be avoided.

Additional context to reproduce

On my system I can reproduce with:

from flytekit.configuration import Config
from flytekit.remote import FlyteRemote

config = Config.for_sandbox()
remote = FlyteRemote(config=config)
remote.client

This is SSHing from one linux system to another linux system. Both are used with a Desktop setup so they probably have the GNOME keyring installed.

I tried using all the different Auth types but they all failed for one reason or another (this is largely expected because we do not have any authentication configured on our flyte deployment).

Full stack trace:
stack_trace.txt

Screenshots

No response

Are you sure this issue hasn't been raised already?

  • Yes

Have you read the Code of Conduct?

  • Yes
@Tom-Newton Tom-Newton added bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers labels Nov 2, 2023
@pingsutw pingsutw added flytekit FlyteKit Python related issue good first issue Good for newcomers and removed untriaged This issues has not yet been looked at by the Maintainers labels Dec 22, 2023
@Future-Outlier
Copy link
Member

We should not use PKCE as the default
image

@taieeuu
Copy link
Contributor

taieeuu commented Nov 12, 2024

#take

@wild-endeavor
Copy link
Contributor

this is the weird part of the stack trace

│ /home/tomnewton/.local/lib/python3.8/site-packages/flytekit/remote/remote.py:205 in client                                                                                                                                                                 │
│ ❱  205 │   │   │   self._client = SynchronousFlyteClient(self.config.platform, **self._kwargs)                                                                                                                                                             │
│ /home/tomnewton/.local/lib/python3.8/site-packages/flytekit/clients/raw.py:44 in __init__                                                                                                                                                                  │
│ ❱  44 │   │   self._channel = wrap_exceptions_channel(cfg, upgrade_channel_to_authenticated(cf                                                                                                                                                             │
│ /home/tomnewton/.local/lib/python3.8/site-packages/flytekit/clients/auth_helper.py:111 in 
upgrade_channel_to_authenticated                                                                                                                                 │
│
│ ❱ 111 │   authenticator = get_authenticator(cfg, RemoteClientConfigStore(in_channel))                                                                                                                                                                      │
│ /home/tomnewton/.local/lib/python3.8/site-packages/flytekit/clients/auth_helper.py:69 in get_authenticator                                                                                                                                                 │
│ ❱  69 │   │   return PKCEAuthenticator(cfg.endpoint, cfg_store, verify=verify)                                                                                                                                                                             

if there's no 401 received, we shouldn't be trying to instantiate a PKCEAuthenticator or any other Authenticator. not sure what's happening. the only weird part of the auth stuff is this line. maybe there's another error happening? Technically we should only be checking for e.code() == grpc.StatusCode.UNAUTHENTICATED. But we added e.code() == grpc.StatusCode.UNKNOWN as a hack because some reverse-proxy setups + grpc versions?? were not returning the correct error.

@wild-endeavor
Copy link
Contributor

hmmm I guess we always call upgrade_channel_to_authenticated which will always call get_authenticator which will always initialize the pkce authenticator if that's the selected option.

can we delay this somehow please? can we make it so that only when there's an error, do we create the authenticator? or something like that.

@Future-Outlier
Copy link
Member

@Tom-Newton can you help me test this one?
flyteorg/flytekit#2962

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working flytekit FlyteKit Python related issue good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants