What is the correct way to start the agent using a...
# prefect-server
j
What is the correct way to start the agent using an API key? Previously this worked:
Copy code
prefect agent local start --token [some-token] --api <https://api.prefect.io>
But after generating an api KEY (not a token) and running a similar incantation:
Copy code
prefect agent local start --token [THE-NEW-KEY] --api <https://api.prefect.io>
it complains with
Copy code
prefect.utilities.exceptions.ClientError: [{'path': ['register_agent'], 'message': 'Unauthorized: permission error.', 'extensions': {'code': 'FORBIDDEN'}}]
k
Token is deprecated. You’d want to make a new API key and then
prefect agent local start --key API_KEY
. But actually I think this should still work.
If you have multiple tenants, maybe try logging out?
prefect auth logout
and then try logging in again. We have a fix for this in the next release so you shouldn’t have to logout
j
When using the incantation you suggested, it gives this error:
Copy code
Error: no such option: --key
k
Ah ok. You are on a version below 0.15.0?
j
We're on 14.21 Do we need to upgrade?
k
Can you try the
--token
but also do the logout first and take out any keys/tokens in the
config.toml
?
j
When running this:
Copy code
prefect auth logout
it complains:
Copy code
Error: Auth commands with server are not currently supported.
There is no config.toml for either of the users that execute prefect on this machine.
k
Are you on server or cloud?
j
Cloud
There was a ~/.prefect/backend.toml file though that specified "server". So I deleted that file.
k
Ah ok you can also do
prefect backend cloud
or
prefect backend server
to toggle. I think we should be good to try again
j
Found the issue... Our startup script was still calling
prefect backend server
even though we've been using cloud for months 🤷 The agent starts now using the
--token
argument with the newly generated KEY Thank you Kevin!
k
Ah lol. Glad you figured it out!