Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Step Functions AWS SAM CLI Local Connection Refused Error

Following the steps in the AWS documentation

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

using aws-stepfuncitons-local docker container

I'm getting a connection refused error at the last step

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)"
    }
}

Any help on how to resolve it would be greatly appreciated.

like image 534
Axe Avatar asked May 28 '19 12:05

Axe


2 Answers

The docker container can't talk to services on the host network. To get it to work you need to add '--network host'.

Example:

docker run -p 8083:8083 --network host --env-file aws-stepfunctions-local-credentials.txt amazon/aws-stepfunctions-local

More details here and here

like image 142
alex.catalyst Avatar answered Oct 09 '22 04:10

alex.catalyst


Just update LAMBDA_ENDPOINT to http://host.docker.internal:3001

like image 23
Adarsh Gowda K R Avatar answered Oct 09 '22 04:10

Adarsh Gowda K R