-
-
Notifications
You must be signed in to change notification settings - Fork 773
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
Flask BadRequest error leads to 500 #1807
Comments
virtualenvs/b2b-gateway-pnc-C83Fr2yq-py3.11/lib/python3.11/site-packages/connexion/middleware/exceptions.py Why is the flask app using starlette exceptions? Flask and Starlette are two different frameworks. |
@RobbeSneyders this is https://github.com/spec-first/connexion/releases/tag/3.0.1 asserts it "fixes" FlaskApp, but clearly it does not. I Updated this comment as it seems that 3.0.0. causes silent test failure to run. |
Closing... This is due to API changes (which I should have expected from a 2->3 upgrade. Apologies
These lines needed their callback function signature (so our code) updated to the new format shown in 😊 😂 (apologies) 🏳️ |
Thanks for reporting back @LewisCowlesMotive. I'm working on a migration guide which will highlight this better. |
Thanks and sorry. I kept looking in other folks repo's swearing about the function erroring, only to realise it was our own. Do you know if Magnum should work for this in API-Gateway Lambda? We used to use a wsgi adapter, but it looks like one of the big changes is using ASGI now instead. I Shipped it working in pipelines and local only to find an error about call not getting enough arguments. It seems like it now needs ASGI |
I'm happy to share anything I can if you point me at where you'd like to document. I Actually like the greater encapsulation provided in all the changes I've made.
|
In theory we can support both ASGI and WSGI middleware (if you're using the FlaskApp), but they should be inserted at different places in the middleware stack. We currently don't provide an interface to insert WSGI middleware, but I can see the value in this and it should be a superficial change. I'll try to include it in a new release next week. If you're blocked, here is a (really ugly and untested) workaround. app = connexion.FlaskApp()
app._middleware_app.asgi_app.app = YourWSGIMiddleware(app._middleware_app.asgi_app.app)
I already have the migration guide partially written locally. I'll try to push it over the weekend. You can either add any input as a response here and I'll include it, or you can add it yourself to the guide afterwards.
Really appreciate the feedback! |
Oh please don't support WSGI [on my account], I'm happy to switch to ASGI, just working it out if I just replace our dependency with Magnum and expect it to work. |
I think it would still be good to enable migration for other users as well. Eg. Apache Airflow uses Connexion with WSGI middleware as well and I'm helping them migrate. The stack looks like this:
So we don't have to do any effort to support it. Just provide an interface. |
As discussed in #1807. Allowing the injection of WSGI middleware can enable easier migration from Connexion 2 to Connexion 3. The use cases are limited though, as this will only work for middleware that can work at the end of the middleware stack.
Description
Just updating to 3.0.1 (latest release) I noticed that OpenAPI schema failure on maximum for a float / number value leads to a 500
Expected behaviour
HTTP 400 error describing the problem
Actual behaviour
Steps to reproduce
We have a field in our OpenAPI
it looks like when it fails to validate due to invalid input (1000) then we get this error.
Additional info:
Output of the commands:
python --version
3.11pip show connexion | grep "^Version\:"
3.0.1 we use poetry (see below for locked hashes and pyproject.toml partial)pyproject.toml
The text was updated successfully, but these errors were encountered: