我已经推送了 lambda 函数,正如我在 localstack 中看到的那样,基于以下命令/输出
aws lambda get-function --function-name books1 --endpoint-url=http://localhost:4574
{
"Code": {
"Location": "http://localhost:4574/2015-03-31/functions/books1/code"
},
"Configuration": {
"Version": "$LATEST",
"FunctionName": "books1",
"CodeSize": 50,
"FunctionArn": "arn:aws:lambda:us-east-1:000000000000:function:books1",
"Environment": {},
"Handler": "main",
"Runtime": "go1.x"
}
}
当我尝试执行它时,如下所示,我收到一个错误,我的 localstack 正在一个 docker 容器中运行
aws --endpoint-url= http://localhost:4574 lambda 调用 --function-name books1 /tmp/output.json
An error occurred (InternalFailure) when calling the Invoke operation (reached max retries: 4): Error executing Lambda function: Unable to find executor for Lambda function "books1". Note that Node.js and .NET Core Lambdas currently require LAMBDA_EXECUTOR=docker Traceback (most recent call last):
File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 269, in run_lambda
event, context=context, version=version, asynchronous=asynchronous)
File "/opt/code/localstack/localstack/services/awslambda/lambda_executors.py", line 466, in execute
process.run()
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "/opt/code/localstack/localstack/services/awslambda/lambda_executors.py", line 462, in do_execute
result = lambda_function(event, context)
File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 390, in generic_handler
'Note that Node.js and .NET Core Lambdas currently require LAMBDA_EXECUTOR=docker') % lambda_name)
Exception: Unable to find executor for Lambda function "books1". Note that Node.js and .NET Core Lambdas currently require LAMBDA_EXECUTOR=docker
这个 lambda 是编写的Go
,当我在真正的 AWS 上手动执行它时,它工作得很好。