pierrejeambrun opened a new pull request, #62404:
URL: https://github.com/apache/airflow/pull/62404

   Reverts apache/airflow#62214
   
   I'm having trouble starting breeze with the Fab auth manager because of this 
change. 
   
   I believe this is creating a problem because `get_application_builder` is 
actually also called by the fastapi fab provider routes. (generating token, 
login / login, create users etc...).
   
   So every time we call the fab provider fastapi API, we clear the global 
fastapi APP and the `_return_appbuilder`. 
   
   Then calling a core api fastapi endpiont will try to re-init the APP, before 
the 
   
   ```
     File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
     File "<frozen importlib._bootstrap_external>", line 999, in exec_module
     File "<frozen importlib._bootstrap>", line 488, in 
_call_with_frames_removed
     File "/opt/airflow/airflow-core/src/airflow/api_fastapi/main.py", line 46, 
in <module>
       app = cached_app(apps=os.environ.get("AIRFLOW_API_APPS", "all"))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/opt/airflow/airflow-core/src/airflow/api_fastapi/app.py", line 115, 
in cached_app
       return create_app(apps=apps)
              ^^^^^^^^^^^^^^^^^^^^^
     File 
"/opt/airflow/airflow-core/src/airflow/utils/providers_configuration_loader.py",
 line 54, in wrapped_function
       return func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^
     File "/opt/airflow/airflow-core/src/airflow/api_fastapi/app.py", line 102, 
in create_app
       init_flask_plugins(app)
     File "/opt/airflow/airflow-core/src/airflow/api_fastapi/core_api/app.py", 
line 145, in init_flask_plugins
       flask_app = create_app(enable_plugins=True)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/opt/airflow/providers/fab/src/airflow/providers/fab/www/app.py", 
line 96, in create_app
       init_appbuilder(flask_app, enable_plugins=enable_plugins)
     File 
"/opt/airflow/providers/fab/src/airflow/providers/fab/www/extensions/init_appbuilder.py",
 line 599, in init_appbuilder
       return AirflowAppBuilder(
              ^^^^^^^^^^^^^^^^^^
     File 
"/opt/airflow/providers/fab/src/airflow/providers/fab/www/extensions/init_appbuilder.py",
 line 156, in __init__
       self.init_app(app, session)
     File 
"/opt/airflow/providers/fab/src/airflow/providers/fab/www/extensions/init_appbuilder.py",
 line 208, in init_app
       self._add_admin_views()
     File 
"/opt/airflow/providers/fab/src/airflow/providers/fab/www/extensions/init_appbuilder.py",
 line 304, in _add_admin_views
       auth_manager.register_views()
     File 
"/opt/airflow/providers/fab/src/airflow/providers/fab/auth_manager/fab_auth_manager.py",
 line 618, in register_views
       self.security_manager.register_views()
     File 
"/opt/airflow/providers/fab/src/airflow/providers/fab/auth_manager/security_manager/override.py",
 line 440, in register_views
       if self.auth_user_registration:
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/opt/airflow/providers/fab/src/airflow/providers/fab/auth_manager/security_manager/override.py",
 line 754, in auth_user_registration
       return current_app.config["AUTH_USER_REGISTRATION"]
              ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
   KeyError: 'AUTH_USER_REGISTRATION'
   ```


-- 
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]

Reply via email to