I am trying to deploy a Serverless function via the Serverless CLI and I am getting the following error:
An error occurred: GenerateDownloadLinkLambdaFunction - Function not found:
What's strange is that I've deployed this function for another stage qa
and it deployed fine, but for dev
it just throws the above error.
If I try to manually create the function from the AWS console and deploy it, the Lambda functions menu shows that the function was deployed X seconds ago, however it does not show any of the settings I have in my serverless.yml
file on my machine.
It's also worth noting that I had managed to have this function deployed on the dev
stage but I accidentally deleted it. Since then it refuses to redeploy.
Have been banging my head against the wall as to what I'm doing wrong but can't spot anything, has anyone else encountered a similar issue with Serverless before?
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.