e

    Enda Peng

    8 months ago
    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
    [xxx]# cat ~/.prefect/config.toml 
    [cloud]
    api_key = "*******"
    Kevin Kho

    Kevin Kho

    8 months ago
    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

    Enda Peng

    8 months ago
    I see thx
    Michael Adkins

    Michael Adkins

    8 months ago
    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

    Enda Peng

    8 months ago
    [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
    Michael Adkins

    Michael Adkins

    8 months ago
    What version of Prefect were you on before?
    Glad it’s working for you now
    Tony Liberato

    Tony Liberato

    8 months ago
    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.
    Kevin Kho

    Kevin Kho

    8 months ago
    Haven’t seen this before. How did you generate your key? Can you try explicitly logging out as well?
    Tony Liberato

    Tony Liberato

    8 months ago
    Thanks, Kevin. it was my mistake. I created a bum textfile and called it config.toml int he ~./.prefect folder.
    Kevin Kho

    Kevin Kho

    8 months ago
    Ah ok. Glad you figured it out!
    Tony Liberato

    Tony Liberato

    8 months ago
    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
    Kevin Kho

    Kevin Kho

    8 months ago
    Did you register it?
    Tony Liberato

    Tony Liberato

    8 months ago
    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?
    Kevin Kho

    Kevin Kho

    8 months ago
    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