Reputation: 2415
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?
Upvotes: 26
Views: 22044
Reputation: 41
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.
Upvotes: 4
Reputation: 127
Use sls remove to remove everything from the stack and then run sls deploy
Upvotes: 11
Reputation: 52366
Check your region filter on the menu at the top of the AWS console.
Make sure it's the same as the region you deploy to in serverless.yml:
provider:
name: aws
runtime: nodejs12.x
region: us-east-1
Upvotes: 1
Reputation: 1002
I had the same issue. Can't recall if it was because I changed the function name or because I added
apiGateway:
shouldStartNameWithService: true
to serverless.yml in the provider section. (I did this because I wanted to switch to the new API gateway naming)
Serverless was still tracking the old name, so in order to reset this and be able to deploy again I did these 3 steps:
After that, the serverless deploy
command worked again.
Upvotes: 0
Reputation: 6164
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.
Upvotes: 60