Open agaiduk opened 4 months ago
Hey @agaiduk! 👋 To me this seems like a safe and solid enhancement! I'm all for adding more context to requests. Your implementation would be super appreciated too, but perhaps @seratch or @WilliamBergamin have other insights into this area?
Thanks for the suggestion! The reason why aws_lambda_function_name and aws_lambda_invoked_function_arn are copied to context object is that they are necessary for enabling lazy listeners to function. I hesitate to add others by default as there are much more properties in the AWS context and most developers really don't need it.
My suggestion for this need is to add a function like attach_custom_properties(aws_context, bolt_context)
to the constructor arguments (as an optional one) instead. With this approach, you can add those properties and others can add more as necessary.
I would like to add two parameters from the AWS Lambda context into the BoltRequest context in AWS :
These parameters are useful for manual logging and are accessible directly from the
context
variable withinlambda_handler(event, context)
function when not in Bolt framework. I would like to also make them available in Bolt framework. Proposed code mirrors howbolt_req.context
is currently populated in AWS Lambda adapter handler:I am open to implementing this feature myself if there is desire to add it to bolt-python.
Category (place an
x
in each of the[ ]
)Requirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.