Upgrade from 2.6.0 to 3.0.1, and all APIs are unavailable #1795
-
Hi, We try to upgrade connextion from 2.6.0 to 3.0.1, and all endpoints are unavailable. It looks like The following is code to setup app: def get_bundled_specs(file):
parser = prance.ResolvingParser(str(file.absolute()),
lazy=True,
backend='openapi-spec-validator')
parser.parse()
return parser.specification
def get_flask_app():
connexion_app = connexion.FlaskApp(
__name__,
specification_dir='openapi/',
swagger_ui_options=SwaggerUIOptions(**config['app']['connexion_options']),
)
connexion_app.add_api(
get_bundled_specs(pathlib.Path(__file__).parent / 'openapi' / 'api.yml'),
strict_validation=True,
validate_responses=True,
)
flask_app = connexion_app.app
# skip some code
return flask_app |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 13 replies
-
Hi @czchen, - return flask_app
+ return connexion_app |
Beta Was this translation helpful? Give feedback.
-
Also, note that you should no longer need |
Beta Was this translation helpful? Give feedback.
-
I tried multiple way to make connexion 3.0.0 works, but at the end i revert to my old code. Please have a look and let me knows what should be changed to keep connexion and Flask : i'm using python manage.py run to launch my API for testing purpose ( poetry run python manage.py run)
here the code of my flask app
app/init .py
error_handlers.py
|
Beta Was this translation helpful? Give feedback.
-
I have tried to upgrade to Connexion 3 in this PR, the application factory is here. When trying to start Flask(App) server with
I'm getting the same message as @czchen #1795 (reply in thread):
When printing out the type of the return object of
The application starts fine when using gunicorn with uvicorn workers:
I wonder what goes wrong when using FlaskApp? For development continuing to use Flask as in Connexion v2.* would be really good (and maybe also necessary to be able to use Click and Connexion in the same application?). Edit: @RobbeSneyders when you are saying
do you mean that ASGI server needs to be always used to run the application (actually that is how I understand the docs in here)? And the built-in |
Beta Was this translation helpful? Give feedback.
Yes, you should use an ASGI server.
Note that the built-in
flask
server is just meant for development, and a dedicated server is recommended when running in production anyway (flask docs).Check our docs for: