astronomer / astro-cli

CLI that makes it easy to create, test and deploy Airflow DAGs to Astronomer
https://www.astronomer.io
Other
348 stars 70 forks source link

`astro cli start` starts the webserver with the wrong sequence #1171

Open jedcunningham opened 1 year ago

jedcunningham commented 1 year ago

Describe the bug

apache/airflow#30246, coming in Airflow 2.6, has fixed the webserver to properly honor the [webserver] update_fab_perms config option.

The astro cli, when starting the webserver, does things in this order:

However, the trick is you can't create the first user until the perms have been explicitly synced! This leads you to hit these errors, as it tries the Airflow 2 then Airflow 1 create user command:

Admin is not a valid role. Valid roles are: [] 
...
airflow command error: argument GROUP_OR_COMMAND: `airflow create_user` command, has been removed, please use `airflow users create`, see help above.

What CLI Version did you experience this bug?

Astro CLI Version: 1.9.0

This CLI bug is related to which Astronomer Platform?

Local

What Operating System is the above CLI installed on?

intel macOS 13.2.1

🪜 Steps To Reproduce

Use this runtime 8 alpha in your Dockerfile:

FROM quay.io/astronomer/astro-runtime-dev:8.0.0-alpha2

Disable update_fab_perms (it was enabled again to work around this issue) in your .env:

AIRFLOW__WEBSERVER__UPDATE_FAB_PERMS=False

Then run astro dev start, and observe:

Airflow is starting up! This might take a few minutes…

Error: there might be a problem with your project starting up. ...
Perados commented 9 months ago

Hi @jedcunningham ! Thank you, it took us some time to find the solution. We are still having this issue when running 9.5.0 and astro-cli 1.20.1 locally. Setting AIRFLOW__WEBSERVER__UPDATE_FAB_PERMS=True in .env solves it.