Serverless deploy - Function not found - sls deploy

I’ve faced this issue with Serverless. The issue is caused by how Serverless handles, tracks, and deploys your functions. When you deleted the function you effectively changed the state of your application manually, and it is effectively out of sync.

To resolve this, comment out the function that is refusing to deploy, and run sls deploy. When its finished uncomment the function, and sls deploy again. This time it should deploy your function.


Use sls remove to remove everything from the stack and then run sls deploy


Caution: This will delete and recreate the whole stack including Databases if you have any, so try at your own risk

Use following command:

serverless remove --stage "environment" --region "region"

eg. serverless remove --stage dev --region us-east-1

The point is if you accidently/manually delete anything from the stack then you break the stack. You have to remove it in with above command and clean it up.

Another workaround would be to recreate the deleted component manually but again I suggest go with the above flow and now to break it.