Thread
#prefect-community
    Lee Cullen

    Lee Cullen

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

    Kevin Kho

    7 months ago
    That is the first time I’ve seen it. Did you recently delete this project? Does the CLI work?
    Lee Cullen

    Lee Cullen

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

    Kevin Kho

    7 months ago
    Can you try moving the register outside of the Flow block? I dunno if it will make a difference
    Lee Cullen

    Lee Cullen

    7 months ago
    I've tried that but still getting the same error. I'll try again just to be sure.
    Kevin Kho

    Kevin Kho

    7 months ago
    Oof! It should be
    project_name
    inside register or you can just not name the argument
    Lee Cullen

    Lee Cullen

    7 months ago
    Sorry that was a typo in my sample code. I can confirm I was using
    project_name
    .
    Kevin Kho

    Kevin Kho

    7 months ago
    Ah can you try just leaving it unnamed?
    Lee Cullen

    Lee Cullen

    7 months ago
    Running
    flow.register()
    still gives me invalid project. Weird!
    Kevin Kho

    Kevin Kho

    7 months ago
    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:
    from prefect import Client
    Client().get_available_tenants()
    and see where you are authenticated?
    Lee Cullen

    Lee Cullen

    7 months ago
    prefect auth list-tenants
    only lists one tenant,.
    Kevin Kho

    Kevin Kho

    7 months ago
    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:
    ValueError: Project test not found. Run `prefect create project 'test'` to create it.
    What version of Prefect are you on?
    Lee Cullen

    Lee Cullen

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

    Kevin Kho

    7 months ago
    No worries man I’m that you solved it cuz I was grasping for solutions here. That’s good to know!