You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "jscheffl (via GitHub)" <gi...@apache.org> on 2025/12/31 11:58:27 UTC
[I] User creation in Fab fails when no role specified [airflow]
jscheffl opened a new issue, #59963:
URL: https://github.com/apache/airflow/issues/59963
### Apache Airflow version
3.1.5
### If "Other Airflow 3 version" selected, which one?
_No response_
### What happened?
While testing providers release on 2025-12-30 I noticed that when attempting to create a User in Fab and I miss to set the "Role" field I get a Ooops / HTTP 500 screen:
<img width="1152" height="1271" alt="Image" src="https://github.com/user-attachments/assets/0546ad5b-d3ab-4223-b5c3-9195cf273fbe" />
(see Role field is empty)
<img width="1170" height="472" alt="Image" src="https://github.com/user-attachments/assets/cdc5447c-a8c8-4a49-b37d-baebc8d0d481" />
If a Role is selected it is working.
Stack trace from API Server:
```
2025-12-31T11:17:07.982595Z [error ] Exception on /users/add [POST] [airflow.providers.fab.www.app] loc=app.py:1744
Traceback (most recent call last):
File "/usr/python/lib/python3.12/site-packages/flask/app.py", line 2529, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/python/lib/python3.12/site-packages/flask/app.py", line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/python/lib/python3.12/site-packages/flask/app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/python/lib/python3.12/site-packages/flask/app.py", line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/python/lib/python3.12/site-packages/flask_appbuilder/security/decorators.py", line 151, in wraps
return f(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/python/lib/python3.12/site-packages/flask_appbuilder/views.py", line 237, in add
widget = self._add()
^^^^^^^^^^^
File "/usr/python/lib/python3.12/site-packages/flask_appbuilder/baseviews.py", line 1241, in _add
if form.validate():
^^^^^^^^^^^^^^^
File "/usr/python/lib/python3.12/site-packages/wtforms/form.py", line 330, in validate
return super().validate(extra)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/python/lib/python3.12/site-packages/wtforms/form.py", line 147, in validate
if not field.validate(self, extra):
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/python/lib/python3.12/site-packages/wtforms/fields/core.py", line 234, in validate
stop_validation = self._run_validation_chain(form, chain)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/python/lib/python3.12/site-packages/wtforms/fields/core.py", line 254, in _run_validation_chain
validator(form, self)
File "/usr/python/lib/python3.12/site-packages/flask_appbuilder/security/forms.py", line 25, in roles_or_groups_required
if not form["roles"].data and not form["groups"].data:
~~~~^^^^^^^^^^
File "/usr/python/lib/python3.12/site-packages/wtforms/form.py", line 64, in __getitem__
return self._fields[name]
~~~~~~~~~~~~^^^^^^
KeyError: 'groups'
```
### What you think should happen instead?
Same like in Fab as released with Airflow 3.1.5 there should be a validation error generated, not a HTTP 500:
<img width="784" height="156" alt="Image" src="https://github.com/user-attachments/assets/d48ec8c6-966e-4ad0-8d75-09db24854317" />
### How to reproduce
Use Fab apache-airflow-providers-fab==3.1.1rc1 or start on latest main via `breeze start-airflow --python 3.12 --load-example-dags --backend postgres --executor LocalExecutor --answer y --auth-manager FabAuthManager`
Log in as admin and go to Security->Users, add a user and miss-out to fill the "Roles" field.
### Operating System
Linux
### Versions of Apache Airflow Providers
Fab 3.1.1rc1 or latest main
### Deployment
Other
### Deployment details
_No response_
### Anything else?
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] User creation in Fab fails when no role specified [airflow]
Posted by "abhijeets25012-tech (via GitHub)" <gi...@apache.org>.
abhijeets25012-tech commented on issue #59963:
URL: https://github.com/apache/airflow/issues/59963#issuecomment-3703527171
i would like to fix it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] User creation in Fab fails when no role specified [airflow]
Posted by "junaiddshaukat (via GitHub)" <gi...@apache.org>.
junaiddshaukat commented on issue #59963:
URL: https://github.com/apache/airflow/issues/59963#issuecomment-3703432153
Hi @jscheffl, I've opened a PR to fix this issue: #60015
The fix adds a DataRequired validator to the roles field so users see a proper validation error instead of HTTP 500. I've also added a unit test and included a video demo in the PR.
Would appreciate your review when you have time!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] User creation in Fab fails when no role specified [airflow]
Posted by "jscheffl (via GitHub)" <gi...@apache.org>.
jscheffl closed issue #59963: User creation in Fab fails when no role specified
URL: https://github.com/apache/airflow/issues/59963
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] User creation in Fab fails when no role specified [airflow]
Posted by "junaiddshaukat (via GitHub)" <gi...@apache.org>.
junaiddshaukat commented on issue #59963:
URL: https://github.com/apache/airflow/issues/59963#issuecomment-3702178063
Hi @jscheffl , I’d like to work on this bug where user creation in Fab fails when no role is specified. I’ve read the issue details and understand the validation needs to be fixed instead of an HTTP 500 error. I plan to add a test and fix the validation logic in the Fab auth code. Please assign this to me. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] User creation in Fab fails when no role specified [airflow]
Posted by "jscheffl (via GitHub)" <gi...@apache.org>.
jscheffl commented on issue #59963:
URL: https://github.com/apache/airflow/issues/59963#issuecomment-3703644636
> i would like to fix it
@abhijeets25012-tech oh, a small moment too late, was already merged. But there are other issues to grab as well :-D
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org