我想使用serverless-offline在本地测试 aws lambda 限制。当我运行此代码时,我预计会看到一个错误(TooManyRequestsException),但所有请求都已成功发送。我是否遗漏了什么,或者无法使用无服务器离线测试 aws 限制?
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()