AWS.Lambda.Runtime.API (AWS Lambda Runtime v0.1.1)

View Source

:httpc client for the AWS Lambda Runtime API (version 2018-06-01).

Deliberately dependency free: the only requirement is :inets, which ships with OTP and therefore comes from the ERTS layer at /opt/otp.

The endpoint is taken from the AWS_LAMBDA_RUNTIME_API environment variable that Lambda injects into the sandbox, e.g. 127.0.0.1:9001.

Summary

Functions

Posts an initialisation failure.

Posts a handler failure for request_id.

Posts a successful result for request_id.

Long-polls GET /runtime/invocation/next.

Starts a dedicated :httpc profile and caches the Runtime API endpoint.

Functions

init_error(payload, error_type)

Posts an initialisation failure.

Lambda treats this as a fatal cold-start error and will not send any invocation to this sandbox.

invocation_error(request_id, payload, error_type)

Posts a handler failure for request_id.

invocation_response(request_id, body)

Posts a successful result for request_id.

next_invocation()

Long-polls GET /runtime/invocation/next.

Blocks until Lambda hands over an invocation, which is also the point at which the sandbox is frozen between requests. Returns the response headers (downcased, as a map) and the raw JSON body.

setup()

Starts a dedicated :httpc profile and caches the Runtime API endpoint.

A dedicated profile keeps runtime traffic isolated from whatever the handler does with the default profile, and lets us tune keep-alive without affecting user code.