endpoints: AWS Lambda endpoints

endpointsR Documentation

AWS Lambda endpoints

Description

These endpoints are configured based on the "AWS_LAMBDA_RUNTIME_API" environment variable set by AWS Lambda during initialisation. They generally won't be available locally. The "AWS_LAMBDA_RUNTIME_API" environment variable (accessed through lambda_config) is used in the following functions:

  • get_next_invocation_endpoint returns the endpoint which R must query for the next input. R must send a GET request to this endpoint and will wait until either a response is received or the Lambda instance is shut down for inactivity. When Lambda receives an input from, say, an API Gateway, it will respond to the pending request with details of the input.

  • get_initialisation_error_endpoint returns the endpoint to which an error should be sent if the error occurs when setting up the runtime. This is distinct from errors that occur during handling of an event.

  • get_response_endpoint returns the endpoint to which an event response should be sent. It is unique for each event.

  • get_invocation_error_endpoint returns the endpoint to which errors that occur during event handling should be sent. It is unique for each event.

The values returned by get_next_invocation_endpoint and get_initialisation_error_endpoint are unique in each Lambda instance. That is, the runtime only needs to retrieve their values once. The values returned by get_response_endpoint and get_invocation_error_endpoint are determined by the request_id argument that these functions require, and so need to be recalculated for each event. The request ID is given in the "lambda-runtime-aws-request-id" header in the event.

Usage

get_next_invocation_endpoint(config, runtime_api)

get_initialisation_error_endpoint(config, runtime_api)

get_response_endpoint(config, request_id)

get_invocation_error_endpoint(config, request_id)

Arguments

config

A list of configuration values as created by the lambda_config function. Alternatively, a runtime API host can be provided directly. This would be the case if there's not enough information available to build a full configuration object due to an error.

request_id

For get_response_endpoint and get_invocation_error_endpoint, the ID of the particular event/request. This is provided in the "lambda-runtime-aws-request-id" header of the event.

Value

character


lambdr documentation built on Nov. 25, 2023, 5:08 p.m.