ModuleNotFoundException: Cannot import airflow.api.auth.backend.basic_auth for API authentication (Webserver, scheduler keeps restarting)

Hello,

I have been trying out astronomer on my local machine and I have been getting a ModuleNotFoundException :

Cannot import airflow.api.auth.backend.basic_auth for API authentication due to: No module named 'airflow.api.auth.backend.basic_auth’

Also, with different onbuild images, the behaviour is different.
For example,
with astronomerinc/ap-airflow:1.10.5-buster-onbuild , both scheduler and webserver keep restarting and with astronomerinc/ap-airflow:1.10.12-1-alpine3.10-onbuild , only webserver keeps restarting.

And because of this, I am not able to open localhost:8080/ on the browser.

It would be of great help if anyone can give a solution to this.

Thanks,
Shreyas

Hi @shreyasms98! I’m sorry you ran into this. Can I ask what version of the Astro CLI you’re running? Try upgrading your Astro CLI to v0.22.2 by running:

$ curl -sSL https://install.astronomer.io | sudo bash -s -- v0.22.2

Can you give that a shot and let us know if you run into any issues? You can also install via HomeBrew - more instructions in “CLI Quickstart”.

Context

For context, this issue resulted from a change on our side that added this Env Var at runtime for all users developing locally: ENV AIRFLOW__API__AUTH_BACKEND=airflow.api.auth.backend.basic_auth. This was to support the ability for users to call the new Airflow 2.0 REST API (not out yet).

For users running 1.10.x, however, that auth backend does not exist - hence the error you shared above.

In Astro CLI v0.22.2, we’ve changed that Env Var to be airflow.api.auth.backend.default, which should resolve the issue for all users developing locally independent of Airflow version.

Hi @paola,

I was using the 0.22.1 version of the Astro CLI.
I did upgrade it to 0.22.2 and it worked!

Thanks a lot for the help!

1 Like

Great! No problem - glad this was resolved @shreyasms98.