Q:

Issue with Serverless Deploy after Deleting Object in AWS

I have a Serverless project that was successfully deployed to AWS with multiple Lambda functions and a Step Function state machine with an API Gateway event. I manually deleted the Step Function in AWS and now doing a sls deploy does not deploy the Step Function.
How do I get things back in sync?
Thanks!

A:

I’ve faced this issue with Serverless. The issue is caused by how Serverless handles, tracks, and deploys your functions and resources. When you deleted the step function/state machine you effectively changed the state of your application manually, and it is basically out of sync.
To resolve this, in your serverless.yaml file, comment out the entire step function/state machine that you manually deleted, and run sls deploy. When its finished uncomment the step function/state machine, and sls deploy again. This time it should deploy your step function/state machine again.

