Home > database >  Airflow Error when enabling user registration "get_user_datamodel"
Airflow Error when enabling user registration "get_user_datamodel"

Time:03-01

I am trying to enable user registration, by configuring the "webserver_config.py" file. I have set the AUTH_USER_REGISTRATION variable to True and I have restarted the "webserver" container. I also tried performing down to the services and again up to the services and the error continues. Once enabled the variable already mentioned in the "Login" panel the Register button is shown, but when accessing the "Register" it shows the following error.

Traceback (most recent call last):
  File "/home/airflow/.local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/airflow/.local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/airflow/.local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/airflow/.local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/airflow/.local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/airflow/.local/lib/python3.7/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.7/site-packages/flask_appbuilder/views.py", line 127, in this_form_get
    self.form_get(form)
  File "/home/airflow/.local/lib/python3.7/site-packages/flask_appbuilder/security/registerviews.py", line 175, in form_get
    self.add_form_unique_validations(form)
  File "/home/airflow/.local/lib/python3.7/site-packages/flask_appbuilder/security/registerviews.py", line 155, in add_form_unique_validations
    datamodel_user = self.appbuilder.sm.get_user_datamodel
AttributeError: 'AirflowSecurityManager' object has no attribute 'get_user_datamodel'

I should add that both the "airflow.cfg" and "webserver_config.py" file I have as volume so as not to lose the configuration.

Python version: 3.7.12

Airflow version: 2.2.3

The variable AUTH_USER_REGISTRATION = True must be enabled in the file "webserver_config.py", verify that the variable AUTH_TYPE has AUTH_DB as value and finally validate that AUTH_DB is imported.

CodePudding user response:

This is an issue in Airflow 2.2.3, #20449. Should be fixed in Airflow 2.2.4.

  • Related