0

I would like to test aws lambda limits locally with serverless-offline. When I ran this code I expected to see an error (TooManyRequestsException) but all request are sent successfully. Am I missing something, or is it not possible to test aws limits with serverless-offline?


const lambda = new Lambda({
    apiVersion: '2031',
    region: 'us-east-1',

    endpoint: 'http://localhost:3002',
})

async function runMultipleLamdas() {
    const params = {
        // FunctionName is composed of: service name - stage - function name, e.g.

        FunctionName: 'simple-http-endpoint-dev-currentTime',

        InvocationType: 'RequestResponse',

        Payload: JSON.stringify({ data: 'foo' }),
    }

    Promise.all(Array(10000).fill(lambda.invoke(params).promise())).then(
        (values) => {
            console.log(values)
        }
    )
}

runMultipleLamdas()
Dennis Traub
  • 50,557
  • 7
  • 93
  • 108
N1mbus
  • 61
  • 1
  • 5

1 Answers1

1

serverless-offline doesn't simulate the AWS service quota for concurrent Lambda function executions. The AWS default quota value of 1,000 concurrent execution per region is a soft limit anyway, and can be raised through the AWS Service Quotas console.

Dennis Traub
  • 50,557
  • 7
  • 93
  • 108
  • Thanks Dennis! Quick question, does the same thing apply if I invoke the lambda through the aws-cli? Like this: aws lambda invoke /dev/null --endpoint-url http://localhost:3002 --function-name simple-http-endpoint-dev-currentTime – N1mbus Jan 03 '21 at 12:11