codetheweb / serverless-step-functions-local

Run AWS step functions offline with Serverless

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ExecutionFailed for Lambda.ResourceNotFoundException

535983297 opened this issue · comments

Thanks a lot for the repo!
I tried to create a sample according to the README said.
But got the error in the following. Did I set the wrong parameters?

offline: Attempt to invoke function 'hello' failed. Function does not exists.
[Serverless Step Functions Local]
[Serverless Step Functions Local] 2021-05-13 15:24:45.237: arn:aws:states:ap-southeast-1:101010101010:execution:StepFunctionSample:1313ef95-d8f5-4791-a438-ae17ca61c946 : {"Type":"LambdaFunctionFailed","PreviousEventId":4,"LambdaFunctionFailedEventDetails":{"Error":"Lambda.ResourceNotFoundException","Cause":"Function not found: hello (Service: AWSLambda; Status Code:
404; Error Code: ResourceNotFoundException; Request ID: null)"}}

[Serverless Step Functions Local]
[Serverless Step Functions Local] 2021-05-13 15:24:45.242: arn:aws:states:ap-southeast-1:101010101010:execution:StepFunctionSample:1313ef95-d8f5-4791-a438-ae17ca61c946 : {"Type":"ExecutionFailed","PreviousEventId":5,"ExecutionFailedEventDetails":{"Error":"Lambda.ResourceNotFoundException","Cause":"Function not found: hello (Service: AWSLambda; Status Code: 404; Error Code: ResourceNotFoundException; Request ID: null)"}}

Here is my serverless.yml.

plugins:
  - serverless-offline
  - serverless-offline-lambda
  - serverless-step-functions
  - serverless-step-functions-local

custom:
  stepFunctionsLocal:
    accountId: 101010101010
    region: ap-southeast-1
    lambdaEndpoint: http://localhost:3002
    TaskResourceMapping:
      FirstState: arn:aws:lambda:ap-southeast-1:101010101010:function:first-function

functions:
  first-function:
    handler: src/functions/stepFunctionLocalSample.firstFunction

stepFunctions:
  stateMachines:
    StepFunctionSample:
      definition:
        Comment: "An example of step function locally"
        StartAt: FirstState
        States:
          FirstState:
            Type: Task
            Resource: 
              Fn::GetAtt: [first-function, Arn]
            Next: done
          done:
            Type: Pass
            End: true   

Set the ARN to arn:aws:lambda:us-east-1:123456789012:function:project-name-dev-hello and got the right result.
I am fine.
Thank you!