Danangjoyoo / flask-http-middleware

Flask HTTP Middleware with starlette's (FastAPI) BaseHTTPMiddleware style
MIT License
12 stars 1 forks source link

Issue with Flask 2.3 #5

Closed mariofix closed 1 year ago

mariofix commented 1 year ago

Hi! I have a problem when using Flask 2.3.x I get this error when loading any page

Traceback (most recent call last):
  File "/home/mariofix/.cache/pypoetry/virtualenvs/firenze-XTdKpJkd-py3.11/lib/python3.11/site-packages/flask_http_middleware/manager.py", line 113, in __call__
    response = self.app.handle_exception(e)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mariofix/.cache/pypoetry/virtualenvs/firenze-XTdKpJkd-py3.11/lib/python3.11/site-packages/flask_http_middleware/manager.py", line 96, in __call__
    self.app.try_trigger_before_first_request_functions()
AttributeError: 'Flask' object has no attribute 'try_trigger_before_first_request_functions'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mariofix/.cache/pypoetry/virtualenvs/firenze-XTdKpJkd-py3.11/lib/python3.11/site-packages/flask/app.py", line 2213, in __call__
    return self.wsgi_app(environ, start_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mariofix/.cache/pypoetry/virtualenvs/firenze-XTdKpJkd-py3.11/lib/python3.11/site-packages/werkzeug/middleware/proxy_fix.py", line 182, in __call__
    return self.app(environ, start_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mariofix/.cache/pypoetry/virtualenvs/firenze-XTdKpJkd-py3.11/lib/python3.11/site-packages/flask_http_middleware/manager.py", line 121, in __call__
    ctx.auto_pop(error)
AttributeError: 'RequestContext' object has no attribute 'auto_pop'

I can also confirm the error disappears when downgrading to flask 2.2.5

Danangjoyoo commented 1 year ago

Hi thanks for reporting, I'll be checking this compatibility issue soon

Danangjoyoo commented 1 year ago

Hi this issue already fixed, please update your flask-http-middleware to the newest