Hi all! I keep running into an issue when register...
# ask-community
l
Hi all! I keep running into an issue when registering a flow to prefect cloud. I can successfully do it when running via CLI but when I switch to registering through flow.register() i get
Invalid Project!
even though the project exists.
k
That is the first time I’ve seen it. Did you recently delete this project? Does the CLI work?
l
Hey Kevin. The project exists on the cloud UI. When running it via CLI it works fine but when i register after my flow definition it doesn't work (see code sample above). Error:
Invalid project!
When i run
prefect get projects
on the cli I can see the project. I have also authenticated via service account so Im not sure what I'm doing wrong.
k
Can you try moving the register outside of the Flow block? I dunno if it will make a difference
l
I've tried that but still getting the same error. I'll try again just to be sure.
k
Oof! It should be
project_name
inside register or you can just not name the argument
l
Sorry that was a typo in my sample code. I can confirm I was using
project_name
.
k
Ah can you try just leaving it unnamed?
l
Running
flow.register()
still gives me invalid project. Weird!
k
No I mean
flow.register("project1")
. Just empty?
Do you use your API key in the CLI or something? I’m wondering about authentication to a different tenant?
Maybe you can try:
Copy code
from prefect import Client
Client().get_available_tenants()
and see where you are authenticated?
l
prefect auth list-tenants
only lists one tenant,.
k
I am wondering if the Client is getting another token or something rather than the CLI (which I can’t imagine but I have no better ideas at the moment)
I find your log weird because mine is:
Copy code
ValueError: Project test not found. Run `prefect create project 'test'` to create it.
What version of Prefect are you on?
l
This is rather embarrassing 😅. So the error I was getting was related to one of my own arg parser functions (used to run specific flows from the cli). Once I resolved that issue then the flow registered successfully. Thanks anyway for your help, it was really informative.
k
No worries man I’m that you solved it cuz I was grasping for solutions here. That’s good to know!
🙌 2