-
-
Notifications
You must be signed in to change notification settings - Fork 769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FlaskApp context issue #1824
Comments
Hey, which version of starlette are you using? I noticed today that my test cases are failing with the same error message when using starlette |
Exactly! I am using pipenv, explicitly installing starlette<=0.32.0.post1 made it work! Thanks for the help! |
Could we not close this issue yet? I am also having problems with starlette 0.33.0 breaking unit tests and have had to pin it to 0.32.0-post1 also. Pinning dependencies is a workaround, not a resolution. |
Reoppening until issue with starlette 0.33.0 is resolved |
@BoldizsarP in #1828 and Connexion 3.0.4 we have pinned starlette to <0.33.0. So no additional pinning is needed for now until encode/starlette#2361 is resolved. Ref: #1826 |
+1 on encountering this issue with connexion and base_path / openapi servers configuration.
Using connexion 3.0.4 or downgrading starlette to <0.33.0 solves the issue. |
Description
I am using connexion as the API handler for a webapp that runs via the included flask app. If I am using 2.0, my stack, consisting of
native flask syntax
(Mind you app is FlaskApp.app)
...
@app.route("/")
def index():
return redirect("/app")
...
and connexion+openapi3.0 syntax
works as expected.
Expected behaviour
The underlying flask app serves all the html file requests, while the openapi specifications are handling the api endpoints.
Actual behaviour
I get this issue for the endpoints:
ERROR:connexion.middleware.exceptions:RuntimeError("Working outside of operation context. Make sure your app is wrapped in a ContextMiddleware and you're processing a request while accessing the context.")
Steps to reproduce
I have included the app,py
a sample openapi yaml, and the corresponding endpoint handler file.
The api file should be under ./api
the openapi should be under ./swagger
the app.py should be in top of relative path
Additional info:
It works flawlessly in 2.0, if I just downgrade it works
Output of the commands:
Python 3.11.0
Version: 3.0.3
Conn3IssueApp.txt
Conn3IssueLogin.yaml.txt
Conn3IssueLogin.py.txt
Thanks guys!
The text was updated successfully, but these errors were encountered: