Step Functions AWS SAM CLI 本地连接被拒绝错误

Axe*_*Axe 5 amazon-web-services aws-step-functions aws-sam-cli

按照 AWS 文档中的步骤操作

https://docs.aws.amazon.com/step-functions/latest/dg/sfn-local-lambda.html

使用 aws-stepfuncitons-local docker 容器

我在最后一步收到连接被拒绝的错误

2019-05-28 12:37:05.004: arn:aws:states:us-east-1:123456789012:execution:HelloWorld:test : 
{
    "Type":"ExecutionFailed",
    "PreviousEventId":5,
    "ExecutionFailedEventDetails":
    {
        "Error":"Lambda.SdkClientException",
        "Cause":"Unable to execute HTTP request: Connect to 127.0.0.1:3001 [/127.0.0.1] failed: Connection refused (Connection refused)"
    }
}
Run Code Online (Sandbox Code Playgroud)

任何有关如何解决它的帮助将不胜感激。

小智 7

docker 容器无法与主机网络上的服务通信。要使其正常工作,您需要添加“--network host”。

例子:

docker run -p 8083:8083 --network host --env-file aws-stepfunctions-local-credentials.txt amazon/aws-stepfunctions-local
Run Code Online (Sandbox Code Playgroud)

更多细节在这里这里