lambda
The http source receives inputs from AWS Lambda.
The lambda source implements the AWS Lambda Runtime API. It provides a source that will receive events from Lambda and use them to invoke functions.
A runner can be created as a custom layer in AWS Lambda. Functions can then
provide their own runtime. The runner may either be called bootstrap
or be
placed beside a script called bootstrap
that starts the runner. The following
is a small reusable bootstrap
script.
#!/bin/sh
./fnrunner
fnrunner Key
fnrun.source/lambda
Configuration
The following table describes the keys on the configuration object for the lambda source.
Key | Type | Default | Description |
---|---|---|---|
jsonDeserializeEvent | Boolean | true | Indicates whether the request event should be deserialized from JSON |
Inputs
Inputs generated by the lambda source are objects with the following keys.
Key | Type | Description |
---|---|---|
LambdaRuntimeAwsRequestId | String | The unique request ID from the Lambda runtime |
LambdaRuntimeDeadlineMs | Integer | The number of milliseconds until the Lambda execution deadline |
LambdaRuntimeTraceId | String | The X-Ray tracing header value |
event | String | The Lambda event |
Outputs
The lambda source expects successful outputs to be either a String or an Object that can be serialized to JSON. The source will post the result using the Lambda Runtime API.
If the fn returns an error, it will be posted as an error to the Lambda Runtime API.
Examples
The following example shows a simple system that receives events from AWS Lambda and invokes a Node.js function with the event.
source: fnrun.source/lambda
middleware:
- fnrun.middleware/key: event
fn:
fnrun.fn/cli: node ./fn.js