Hi, I'm attempting to register a flow from the CLI...
# prefect-community
j
Hi, I'm attempting to register a flow from the CLI to the cloud, and keep meeting with this error, and I'm hoping someone has seen this before and can tell me what mistake I'm making.
👀 1
Copy code
prefect.utilities.exceptions.ClientError: [{'path': ['project'], 'message': 'field "project" not found in type: \'query_root\'', 'extensions': {'path': '$.selectionSet.project', 'code': 'validation-failed', 'exception': {'message': 'field "project" not found in type: \'query_root\''}}}]
the project exists, I just created this user auth token, there don't seem to be many places where I could go wrong, yet still I do..
n
Hi @John Grubb - did you call
prefect auth login
?
j
I did, passing the token and it tells me
Copy code
Auth token already present in config.
Aborted!
Presumably it's referring to the
PREFECT__CLOUD__AUTH_TOKEN
env var
n
@John Grubb can you try unsetting that auth token variable wherever you have it set, both as the environment variable and in your
config.toml
if it's set there and then manually passing it to
prefect auth login -t <YOUR_TOKEN>
?
👍 1
j
so, that worked.
If I dig into
.prefect/client/.../settings.toml
I see my API token as well as an
active_tenant_id
Does that need to be set as an env var as well?
Ooo, this new timeline view is slick
😄 1
n
Ok great, so I think happened is you manually set that variable to a personal access token, which can only be used to log in but can't be used for other operations. Since
prefect auth login
would normally set that variable, it sees that it's already been manually set (but doesn't check the type), and doesn't perform the login operation.
When you unset that variable it can perform the login operation with the personal access token and set your api token as expected.
j
ok thank you! I'm still fumbling about with what tokens belong to what scopes. The User token cannot perform CLI things like register? That wouldn't be an agent token though, would it?
Oh, a tenant token perhaps? Is that what belongs in the
PREFECT__CLOUD__AUTH_TOKEN
env var?
👍 1
n
You're correct, the user token can't perform CLI commands except for
login
, and agent tokens are similarly limited.
This is something we're actively working on, to make the process less confusing... stay tuned 🙂
j
I certainly will, thank you for the help. My terrible internet today has provided the motivation to finish moving this POC up to the cloud where it belongs, so thank you very much 🙇
🚀 1
🙏 1