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

Having PREFECT_API_KEY as env var prevent from login to cloud #7797

Closed
4 tasks done
Andarius opened this issue Dec 7, 2022 · 6 comments · Fixed by #8641
Closed
4 tasks done

Having PREFECT_API_KEY as env var prevent from login to cloud #7797

Andarius opened this issue Dec 7, 2022 · 6 comments · Fixed by #8641
Assignees
Labels
bug Something isn't working cli Related to the Prefect CLI

Comments

@Andarius
Copy link

Andarius commented Dec 7, 2022

First check

  • I added a descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the Prefect documentation for this issue.
  • I checked that this issue is related to Prefect and not one of its dependencies.

Bug summary

When having PREFECT_API_KEY set as an environment variable, the prefect cloud login command will exit with This profile is already authenticated with that key. without being actually logged in.

Reproduction

PREFECT_API_KEY=foo prefect cloud login -k foo

Error

We are not actually logged in.

Versions

Version:             2.7.0
API version:         0.8.3
Python version:      3.10.5
Git commit:          c2833339
Built:               Thu, Dec 1, 2022 4:03 PM
OS/Arch:             linux/x86_64
Profile:             default
Server type:         ephemeral
Server:
  Database:          sqlite
  SQLite version:    3.38.5

Additional context

No response

@bunchesofdonald
Copy link
Contributor

Thanks for the bug report @Andarius!

@zanieb
Copy link
Contributor

zanieb commented Dec 7, 2022

We've already got a utility to check if the key actually works so this should be a quick fix.

@zanieb zanieb added the good first issue This issue is good for newcomers label Dec 7, 2022
@ahadmushir
Copy link

Hello @madkinsz and @bunchesofdonald,
I would like to look into this issue if it's not being worked on!

@zanieb
Copy link
Contributor

zanieb commented Dec 11, 2022

Great! Let us know if you have any questions :)

@sonikagoyal84
Copy link

RUN prefect profile use default
RUN prefect cloud login -k abc --workspace cdf

@VeraZab
Copy link

VeraZab commented Feb 23, 2023

just adding this here in case anyone else encounters:
I thought just giving the key a different name could be a temporary fix, but it turns out this environment variable (with this exact name) has to be set, if not I'm getting errors like: RuntimeError: Cannot create flow run. Failed to reach API and so no flows can run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli Related to the Prefect CLI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants