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?
The sls deploy command deploys your entire service via CloudFormation. Run this command when you have made infrastructure changes (i.e., you edited serverless. yml ).
Invokes a deployed function. You can send event data, read logs and display other important information of the function invocation.
sls-dev-tools is an open source project that aims to be a set of developer tools for the serverless world. Basing the interface in the terminal allows it to run in the development environment. It provides: Rapid in-terminal feedback—no need to use the AWS Management Console.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With