deployPreLambda

Exports an async function that deploys our pre queue Lambda, which is the Lambda triggered by the API Gateway resource "/beekeeper", i.e. first time visitors.

Source:

Methods

(async, inner) addLambdaPermission(lambda, lambdaName)

Source:

Adds a permission so that the API Gateway can trigger the Lambda.

Parameters:
Name Type Description
lambda LambdaClient

Looks like new LambdaClient({ region })

lambdaName String

A constant beekeeper-${PROFILE_NAME}-prelambda

(async, inner) createPreLambda(lambda, lambdaName, sqsUrl, code, roleArn, region, s3ObjectRootDomain, protectUrl) → {String}

Source:

Function that creates the pre-queue Lambda. This deployment sets several environment variables so that the preLambda code in its index.js has access to these environment variables. This pre Lambda will generate a token, put that token in the SQS queue, and set custom response headers dependent on the status of the environment variables.

Parameters:
Name Type Description
lambda LambdaClient

Looks like new LambdaClient({ region })

lambdaName String

A constant beekeeper-${PROFILE_NAME}-prelambda

sqsUrl String

URL of the sqs queue returned by deploySQS.js

code String

This is the path of the index.js.zip file holding the code for this Lambda.

roleArn String

Amazon resource number for the kitchen sink role returned by createRole()

region String

A constant destructured from the CLI user's answers in deploy.js. Like "us-east-2".

s3ObjectRootDomain String

Constant https://${bucketName}.s3.${region}.amazonaws.com;

protectUrl String

A constant destructured from the CLI user's answers in deploy.js. Like "https://www.example.com".

Returns:

Returns the ARN of this pre queue Lambda

Type
String