0

I realise this is a duplicate of thousands of posts across the internet, but I have only found solutions for version <2.0, and those solutions do not apply to >2.0.

Basically, I have installed Apache Airflow on an Ubuntu system. Everything installed fine, as far as I see from command line, and I first create a user:

airflow users  create --role Admin --username admin --email admin --firstname admin --lastname admin --password admin

And then from here I start up the webserver and scheduler:

airflow webserver -p 8585 > ${AIRFLOW_HOME}/logs/webserver.log 2>&1 &
airflow scheduler > ${AIRFLOW_HOME}/logs/scheduler.log 2>&1 &

And then I can access the webserver via "http://<HOST_IP>:8585" - This loads to the log in screen no problem.

But when I try to log in using the user details initially created, or by using my OS user (on the off-chance), it just fails with "Invalid login." I've tried restarting the webserver and Ubuntu to no avail.

I've used Airflow <2.0 in the past and never even created a user and just logged in straight away, so I'm really blank on what the answer is here. I absolutely hate Airflow and am loosing my mind just trying to log in, so a massive thanks for any help!

Vinny Pem
  • 57
  • 1
  • 6
  • Is this a clean system or is it possible that there is some old database or other "state" lying around? – malthe Jun 13 '22 at 11:00
  • 1
    This is a fresh system, @malthe. I installed SQLite3 (pip3 install sqlite3) just prior to the above. – Vinny Pem Jun 13 '22 at 12:08
  • I would put a breakpoint in "flask_appbuilder/security/views.py" in `class AuthDBView` to see what's going on. Hard to know more without a bit of information from such an investigation. – malthe Jun 13 '22 at 20:37

2 Answers2

0

Okay, sooo I managed to get it running with login potential. I think I've discovered the issue, at least, and can re-create the problem, though frankly I have ZERO idea why it IS an issue (software coded issue??).

Basically, I had to run the install processes above as ROOT user. I was trying to run it as my admin user, but it kept resulting in the log in issue above - I did notice however that all install guides appear to use the ROOT user, so I gave it a shot in case it was as annoyingly simple as that, and VOILA!! First time logged in.

I did stop the software running at this point, quickly restart it as my admin user and immediately got the same login issue. There's something odd going on here, and I don't know what it is, but when in doubt: Try ROOT.

Vinny Pem
  • 57
  • 1
  • 6
  • Hello! I'm using Airflow 2.3.3 on WSL2, and I'm facing the same issue as you. While I've tried to solve the login issue with your solution, I switch to root user with sudo -s, then I start the airflow user creation, it shows airflow command not found. – 林彥良 Aug 20 '22 at 07:37
0

Solution- Create user again

I ran into the same issue. I had created an Admin user using the same command and after some changes to my config file, I ran airflow db init. After this when I started the webserver, I tried logging in with my admin credentials, but no luck. When I checked the logs, it showed me -

WARNING - No user yet created, use flask fab command to do it.

So I created the user again and it worked.

Ankit Seth
  • 729
  • 1
  • 9
  • 23