Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when enabling user registration "get_user_datamodel" #21847

Closed
2 tasks done
Rodrigo507 opened this issue Feb 27, 2022 · 3 comments
Closed
2 tasks done

Error when enabling user registration "get_user_datamodel" #21847

Rodrigo507 opened this issue Feb 27, 2022 · 3 comments
Labels
area:core invalid kind:bug This is a clearly a bug

Comments

@Rodrigo507
Copy link

Rodrigo507 commented Feb 27, 2022

Apache Airflow version

2.2.3

What happened

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.

What you expected to happen

That users have a form where they must fill out the registration information, and then be able to access

How to reproduce

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.

Operating System

Docker

Versions of Apache Airflow Providers

Python version: 3.7.12
Airflow version: 2.2.3

Deployment

Docker-Compose

Deployment details

Docker version is 4.2.0
Host operating system is Windows 10 version 20H2 (OS Build 19042.1526)
In the Host operating system, WSL 2 is enabled.

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@Rodrigo507 Rodrigo507 added area:core kind:bug This is a clearly a bug labels Feb 27, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Feb 27, 2022

Thanks for opening your first issue here! Be sure to follow the issue template!

@potiuk
Copy link
Member

potiuk commented Feb 28, 2022

Make sure you use constriants when installing Airlfow. otherwise you might get incompatible versions of dependencies (for example FAB in this case). Also you might want to swtich to the official Airflow Docker image (https://airflow.apache.org/docs/docker-stack/index.html)

@potiuk potiuk closed this as completed Feb 28, 2022
@potiuk potiuk added the invalid label Feb 28, 2022
@aa3pankaj
Copy link
Contributor

@Rodrigo507 you can try upgrading to airflow 2.2.4,
related: #21294

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core invalid kind:bug This is a clearly a bug
Projects
None yet
Development

No branches or pull requests

3 participants