atul-astronomer opened a new issue, #55176:
URL: https://github.com/apache/airflow/issues/55176

   ### Apache Airflow version
   
   main (development)
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   ```javascript
    File "/usr/python/lib/python3.10/site-packages/starlette/applications.py", 
line 99, in build_middleware_stack
       app = cls(app, *args, **kwargs)
   TypeError: 'str' object is not callable
   INFO:     127.0.0.1:35798 - "POST /auth/token HTTP/1.1" 500 Internal Server 
Error
   ERROR:    Exception in ASGI application
   Traceback (most recent call last):
     File 
"/usr/python/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py",
 line 409, in run_asgi
       result = await app(  # type: ignore[func-returns-value]
     File "/usr/python/lib/python3.10/site-packages/fastapi/applications.py", 
line 1054, in __call__
       await super().__call__(scope, receive, send)
     File "/usr/python/lib/python3.10/site-packages/starlette/applications.py", 
line 112, in __call__
       self.middleware_stack = self.build_middleware_stack()
     File "/usr/python/lib/python3.10/site-packages/starlette/applications.py", 
line 99, in build_middleware_stack
       app = cls(app, *args, **kwargs)
   TypeError: 'str' object is not callable
   INFO:     127.0.0.1:35806 - "POST /auth/token HTTP/1.1" 500 Internal Server 
Error
   
   ``` 
   
   <img width="975" height="392" alt="Image" 
src="https://github.com/user-attachments/assets/92ee568e-ed69-4ca7-854c-1b13185c6403";
 />
   
   ### What you think should happen instead?
   
   _No response_
   
   ### How to reproduce
   
   Create below middleware plugin:
   
   ```python
   from airflow.plugins_manager import AirflowPlugin
   from starlette.middleware.base import BaseHTTPMiddleware
   
   class AddHeaderMiddleware(BaseHTTPMiddleware):
       async def dispatch(self, request, call_next):
           response = await call_next(request)
           response.headers["X-Test"] = "true"
           return response
   
   class MyMiddlewarePlugin(AirflowPlugin):
       name = "my_middleware_plugin"
       fastapi_root_middlewares = [
           {
               "name": "test_header",
               "middleware": "AddHeaderMiddleware",
               "options": {}
           }
       ]
   
   ```  
   
   ### Operating System
   
   Linux
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to