Is the feature that loading api_key from `~/.prefe...
# ask-community
e
Is the feature that loading api_key from
~/.prefect/config.toml
deprecated? I tried with
prefect agent local start -t <my-token>
which succeeds, however, after I save it under config.toml and restart without
-t
, it complains about missing API key, this is my config.toml file
Copy code
[xxx]# cat ~/.prefect/config.toml 
[cloud]
api_key = "*******"
k
Tokens are deprecated in favors of API keys but it should backward compatible. I think this changed slightly so you can do
prefect auth login --key API_KEY
and this should take care of authenticating the agent when you do
prefect agent local start
This will create the
auth.toml
file
e
I see thx
z
Your API key should be loadable from the config still as well.
It looks like you’ve specified it correctly in that example as well.
Can you share the error message?
e
Copy code
[2021-12-30 01:32:21,284] ERROR - agent | Failed to verify authentication.
Traceback (most recent call last):
  File "/usr/local/python39/lib/python3.9/site-packages/prefect/agent/agent.py", line 890, in _setup_api_connection
    self._verify_token(self.client.get_auth_token())
  File "/usr/local/python39/lib/python3.9/site-packages/prefect/agent/agent.py", line 821, in _verify_token
    raise AuthorizationError("No agent API token provided.")
prefect.utilities.exceptions.AuthorizationError: No agent API token provided.
I upgrade my prefect to the latest, and delete
config.toml
. Then called login, which creates
auth.toml
. It solves my problem
z
What version of Prefect were you on before?
Glad it’s working for you now
t
I'm a bit stuck here, as well. I ran $prefect auth login -k <MY KEY> and it threw an error: toml.decoder.TomlDecodeError: could not convert string to float: '<MY KEY>' IS this a bug? Now, every time I run a CLI command I get this error.
k
Haven’t seen this before. How did you generate your key? Can you try explicitly logging out as well?
t
Thanks, Kevin. it was my mistake. I created a bum textfile and called it config.toml int he ~./.prefect folder.
k
Ah ok. Glad you figured it out!
t
More to the point, I am trying to figure out how to deploy my workflow to the cloud. I ran $prefect backend cloud then $prefect auth login -k MY KEY. All was good. but My flow was not deployed to cloud
k
Did you register it?
1
t
I have a local installation from last week, I am trying to move to prefect cloud. I stopped all local containers. set backed to cloud then ran $prefect server start. I was able to create the project on prefect cloud successfully via cli. however, I still have a local UI. The project is not there. Should I not run prefect server start when trying to deploy a flow to prefect cloud?
Ok. Thanks for letting me ramble through this, I was able to register using the CLI. Before, I was trying to register them through Spyder. Either way, I am making progress. This leads me to my closing thought as a question: How do we, as users, troubleshoot and develop our flows and tasks?
k
Cloud and Server are what we call backends. Cloud is our hosted offering of Server. So no you don’t need to spin up server to register on Cloud.
You develop using
flow.run()
, and then when ready to bring to Cloud, use
flow.register()
and run from Cloud
👍 1