Home > Back-end >  Airflow webserver fails with NoneType error
Airflow webserver fails with NoneType error

Time:07-05

I'm having trouble running Airflow on a local k8s (Minikube), using the official Helm chart.

This is my custom Dockerfile:

FROM apache/airflow:2.3.1-python3.10

WORKDIR ${AIRFLOW_HOME}

USER airflow
COPY ./requirements.txt .
RUN pip install --upgrade pip setuptools
RUN pip install --extra-index-url https://path/to/our/repo -r requirements.txt

And this is our requirements.txt file:

python-consul==1.1.0
python-dateutil==2.8.2
boto3==1.24.0
psycopg2-binary==2.9.3
apache-airflow-providers-amazon==3.4.0
apache-airflow-providers-databricks==2.7.0
apache-airflow-providers-postgres==4.1.0

Everything loads as expected, and I set up port-forwarding.

But when I try to get the webserver page, I get the following error:

Something bad has happened.

Airflow is used by many users, and it is very likely that others had similar problems and you can easily find
a solution to your problem.

Consider following these steps:

  * gather the relevant information (detailed logs with errors, reproduction steps, details of your deployment)

  * find similar issues using:
     * GitHub Discussions
     * GitHub Issues
     * Stack Overflow
     * the usual search engine you use on a daily basis

  * if you run Airflow on a Managed Service, consider opening an issue using the service support channels

  * if you tried and have difficulty with diagnosing and fixing the problem yourself, consider creating a bug report.
    Make sure however, to include all relevant details and results of your investigation so far.

Python version: 3.10.4
Airflow version: 2.3.1
Node: airflow-webserver-656ffc59b9-28cb9
-------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/airflow/.local/lib/python3.10/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/airflow/.local/lib/python3.10/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/airflow/.local/lib/python3.10/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/airflow/.local/lib/python3.10/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/airflow/.local/lib/python3.10/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/airflow/.local/lib/python3.10/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/airflow/.local/lib/python3.10/site-packages/airflow/www/auth.py", line 43, in decorated
    return func(*args, **kwargs)
  File "/home/airflow/.local/lib/python3.10/site-packages/airflow/www/views.py", line 826, in index
    dashboard_alerts = [
  File "/home/airflow/.local/lib/python3.10/site-packages/airflow/www/views.py", line 827, in <listcomp>
    fm for fm in settings.DASHBOARD_UIALERTS if fm.should_show(current_app.appbuilder.sm)
  File "/home/airflow/.local/lib/python3.10/site-packages/airflow/www/utils.py", line 771, in should_show
    user_roles = {r.name for r in securitymanager.current_user.roles}
AttributeError: 'NoneType' object has no attribute 'roles'

CodePudding user response:

Upgrading to Airflow 2.3.2 solved the issue.

Also, when doing tests with k8s, it's important to make sure that the docker tag that is set in the values.yaml is identical to the tag that was used when building the local docker image.

Note 2: don't mix defaultAirflowTag with airflowVersion.

The first id the tag of the docker image you wish to use. The second is the version of Airflow that you're using.

  • Related