A helper lib to customize the communication between the lambda handler process and the lambda runtime api.
See the examples folder for more details.
Some real world cases:
- Override reserved environment variables like
AWS_LAMBDA_RUNTIME_API
. - Capture or modify the output of the handler function, including the stdout, stderr, or the return value.
- Add additional command line arguments to the handler process.
This library will do the following:
- Start an HTTP server to act as the fake AWS Lambda runtime API server, accepting requests from the handler process.
- Spawn the handler process as a child process, with the environment variables modified to point to the fake AWS Lambda runtime API server.
- (Optional) Forward requests from the handler process to the real AWS Lambda runtime API server.
Based on this setup, you can write your own logic to process the requests and responses between the handler process and the AWS Lambda runtime API.
See benchmark. TLDR: the proxy will introduce less than 2ms latency, which is acceptable for most use cases.