-
Notifications
You must be signed in to change notification settings - Fork 153
Bug: Lambda context access in batch processing record handler #1635
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
Comments
Hi Erika, thank you for opening this issue. From a first look in the codebase it seems that the issue is valid. If you or anyone bumping into this is interested in proposing a PR, I'd be happy to help you get it merged. Otherwise we'll work on a fix before the next release later next week. |
|
This is now released under v1.13.0 version! |
Expected Behaviour
Based on the Python implementation, the record handler should be defined to accept a
Context
object in order to access the Lambda context.Current Behaviour
Currently, the processor will pass the entire
BatchProcessingOptions
object to the handler, so if a handler is defined matching a Python handler, expecting a context parameter of typeContext
, theContext
attributes and methods will be inaccessible.Code snippet
Steps to Reproduce
This code is from the documentation example. When running the example, there will be an error that
getRemainingTimeInMillis()
is not a function.Possible Solution
In order to have the code work by redefining the handler, it has to be something like this:
Otherwise, the processor should be redefined to pass a
Context
object to the handler instead of aBatchProcessingOptions
type object.Powertools for AWS Lambda (TypeScript) version
latest
AWS Lambda function runtime
16.x
Packaging format used
npm
Execution logs
The text was updated successfully, but these errors were encountered: