Skip to content

Feature request: support accessing Lambda context in record handler #1607

@dreamorosi

Description

@dreamorosi

Use Case

In the Python version of Powertools for AWS, when using Batch Processing and specifying a record handler customers can optionally configure the utility to pass the Lambda context to the record handler. This is useful in those cases in which the record handler needs to be aware of info from the context or needs to be able to retrieve the amount of time left before the function times out.

Solution/User Experience

Refer to the implementation described here.

In Python the feature is possible thanks to the existence of keyword arguments, customers can simply specify an argument named lambda_context in the record handler function and the Batch Processing utility will propagate the context from the function to it. In JS there's no notion of keyword arguments so we'll have to find an alternative solution. Proposals/ideas are welcome.

Acceptance criteria

  • Unit tests are implemented with 100% coverage
  • Added code is documented via docstrings, following project's conventions as much as possible

Metadata

Metadata

Assignees

Labels

batchThis item relates to the Batch Processing UtilitycompletedThis item is complete and has been merged/shippedfeature-requestThis item refers to a feature request for an existing or new utility

Type

No type

Projects

Status

Shipped

Relationships

None yet

Development

No branches or pull requests

Issue actions