Reputation: 669
I am trying to test AWS State Machine and Lambda function by following Step Functions and AWS SAM CLI Local
The Lambda is running on local docker container as expected, and I can get proper result after invoke lambda function with command aws lambda invoke --function-name
The step function is running as expected as well.
The Lambda and Step function is up and running at local, but got following error when start State machine which reference SAM CLI Local Function.
An error occurred (404) when calling the CreateStateMachine operation: PathNotFoundException
Also seeing following message from lambda function terminal when started state machine:
2022-11-09 13:02:35 127.0.0.1 - - [09/Nov/2022 13:02:35] "POST / HTTP/1.1" 404 -
Following are some partial code and command for this test.
Partial code in template.yaml from Lambda function
Resources:
TestLambda:
Type: AWS::Serverless::Function
Step function local setting file(sf-setting-local.txt)
AWS_ACCOUNT_ID=123456789012
LAMBDA_ENDPOINT=http://127.0.0.1:3001
AWS_ACCESS_KEY_ID=xxxxxxxxxx
AWS_SECRET_ACCESS_KEY=xxxxxxxxxx
AWS_DEFAULT_REGION=us-east-1
state machine file:(state_machine.json)
{
"Comment": "An example of the Amazon States Language using an AWS Lambda Local function",
"StartAt": "LambdaDocker",
"States": {
"LambdaDocker": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-east-1:123456789012:function:TestLambda",
"End": true
}
}
}
Command to create State Machine:
aws stepfunctions --endpoint-url "http://127.0.0.1:3001" create-state-machine --definition file://state_machine.json --name "TestLambda" --role-arn "arn:aws:iam::123456789012:role/DummyRole"
What could cause this PathNotFoundException error? Any suggestion is appreciated!
Upvotes: 0
Views: 984
Reputation: 669
There 2 things I have to correct to make this test work:
Upvotes: 0