You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure what is the best way to do that, maybe we can discuss about adding Lambda specific traits to Smithy IDL, or maybe we can provide that information via Request::extensions in Rust and with a app.lambda_context decorator in Python.
The text was updated successfully, but these errors were encountered:
Most of that information is stored in request extensions already by the Lambda runtime (e.g. RequestContext), which we preserve in that convert_event function since we reconstruct the request with the converted body type using http::Request::from_parts(parts, body).
So to access it as of now, the user just has to model it in their State and AddExtensionLayer will take care of extracting it.
However, I do think that the general problem of threading request-specific state to service handlers (as opposed to global application state), which includes things like Lambda context, peer IP address, request ID, etc. needs to be solved more ergonomically.
@david-perez ohh I missed that. I'll convert this issue to be Python specific. Do we have a tracking ticket for the last part or do you want me to create a ticket for that?
unexge
changed the title
Provide a way to access Lambda Context
Provide a way to access Lambda Context in Python
Nov 1, 2022
lambda_http crate provides RequestExt trait to allow accessing some additional information. Currently we convert Lambda request to Hyper request in: https://github.com/awslabs/smithy-rs/blob/main/rust-runtime/aws-smithy-http-server/src/routing/lambda_handler.rs#L49-L89
and we lose the information that specific to Lambda. Ideally we should provide a way to access that information.I'm not sure what is the best way to do that, maybe we can discuss about adding Lambda specific traits to Smithy IDL, or maybe we can provide that information
viawith aRequest::extensions
in Rust andapp.lambda_context
decorator in Python.The text was updated successfully, but these errors were encountered: