I am trying to setup a step functions workflow in my serverless app. What I want to happen is that when the UserPost endpoint is called it creates the user and proceeds to run through the step functions after. Currently I have this flow in my serverless.yml
serverless.yml
functions:
UserPost:
handler: handlers/user/post.handler
events:
- http:
path: /user
method: post
cors: true
UserProcessingStepOne:
handler: handlers/user/processing/step.one.handler
UserProcessingStepTwo:
handler: handlers/user/processing/step.two.handler
UserProcessingStepThree:
handler: handlers/user/processing/step.three.handler
UserProcessingStepFour:
handler: handlers/user/processing/step.four.handler
UserProcessingStepFive:
handler: handlers/user/processing/step.five.handler
stepFunctions:
stateMachines:
UserPostStateMachine:
definition:
Comment: "Create And Process User Workflow"
StartAt: UserPost
States:
UserPost:
Type: Task
Resource: "arn:aws:lambda:#{AWS::Region}:${AWS::AccountId}:function:${self:service}-${opt:stage}-UserPost"
Next: UserProcessingStepOne
UserProcessingStepOne:
Type: Task
Resource: "arn:aws:lambda:#{AWS::Region}:${AWS::AccountId}:function:${self:service}-${opt:stage}-UserProcessingStepOne"
Next: UserProcessingStepTwo
UserProcessingStepTwo:
Type: Task
Resource: "arn:aws:lambda:#{AWS::Region}:${AWS::AccountId}:function:${self:service}-${opt:stage}-UserProcessingStepTwo"
Next: UserProcessingStepThree
UserProcessingStepThree:
Type: Task
Resource: "arn:aws:lambda:#{AWS::Region}:${AWS::AccountId}:function:${self:service}-${opt:stage}-UserProcessingStepThree"
Next: UserProcessingStepFour
UserProcessingStepFour:
Type: Task
Resource: "arn:aws:lambda:#{AWS::Region}:${AWS::AccountId}:function:${self:service}-${opt:stage}-UserProcessingStepFour"
Next: UserProcessingStepFive
UserProcessingStepFive:
Type: Task
Resource: "arn:aws:lambda:#{AWS::Region}:${AWS::AccountId}:function:${self:service}-${opt:stage}-UserProcessingStepFive"
End: true
Now in each of the processing files I have a console log that is something like this:
module.exports.handler = async (event) => {
context.callbackWaitsForEmptyEventLoop = false
console.log("Processing Step One: Process Profile")
}
Now when send data as a POST request to my /user endpoint it is working properly. But, I do not see any of the step functions being executed afterwards. Is there something I am missing?