Invoking in a serverless context #1827
-
ContextWe utilize connexion (v2) in AWS Lambda currently, and since there's no actual python server software running, we wrote our own handler that takes the lambda invocation event, creates the connection app ( My QuestionIs there a recommended way to do this sort of setup in connexion v3 (send request and get a response directly without the need for a server wrapper)? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @drewpearce, Connexion now implements the ASGI interface, which is a Python interface that can be called directly. You'll probably need some boilerplate to encode your invocation event into the ASGI scope and channels though. This is what I think the most logical place to add this in the ASGI ecosystem, would be in Starlette, or otherwise asgiref. Starlette already offers most of the needed functionality as part of its For a long term fix, I would propose that you open a discussion on the Starlette repo to check if this is something they would be open to support. For a short term fix, I see two options:
|
Beta Was this translation helpful? Give feedback.
Hi @drewpearce,
Connexion now implements the ASGI interface, which is a Python interface that can be called directly. You'll probably need some boilerplate to encode your invocation event into the ASGI scope and channels though. This is what
werkzeug.wrappers.Response.from_app
provides for WSGI, but I'm not aware of any equivalent functionality for ASGI.I think the most logical place to add this in the ASGI ecosystem, would be in Starlette, or otherwise asgiref. Starlette already offers most of the needed functionality as part of its
TestClient
, but not with the interface you're looking for.For a long term fix, I would propose that you open a discussion on the Starlette repo to check if…