menghot opened a new pull request, #58196:
URL: https://github.com/apache/airflow/pull/58196
This issue was introduced starting with #50960 (Upgrade FAB to FAB 5)
Root cause:
Two Flask application were created
1.
providers/fab/auth_manager/cli_commands/utils.py#get_application_builder()
2. providers/fab/www/app.py#create_app(enable_plugins: bool)
In providers/fab/www/extensions/init_appbuilder.py
def init_appbuilder(app: Flask, enable_plugins: bool) -> AirflowAppBuilder:
return AirflowAppBuilder(
app=app,
session=settings.Session(),
base_template="airflow/main.html",
enable_plugins=enable_plugins,
)
where the type of settings.Session() is <sqlalchemy.orm.session.Session>
It works for all command line apis, because all command line api wrapped
in the context which able to close automatically
E.g. providers/fab/auth_manager/cli_commands/role_command.py
with get_application_builder() as appbuilder:
roles = appbuilder.sm.get_all_roles()
But it will not works for login API (/api/v2/auth/login):
providers/fab/auth_manager/security_manager/override.py#find_user(self,
username=None, email=None)
It need to set appbuilder session with
<sqlalchemy.orm.scoping.scoped_session> type.
#57065, #57534 and #57470
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]