My team has a set of lambdas as an API. The Apigateway set of endpoints was removed, we tried redeploying but now serverless throws an error in the process. Is it because somehow it was linked to that set of Apigateway endpoints? If that is the case, is there a way for Serverless to generate again them (preferrably with the same URL)?
It really depends how the API GW was removed.
If it was removed manually then you can create a new API GW by
- Comment out every reference to the API GW in your
serverless.yml. That’s all of the http events, authorizers, anything in the resources sections, etc. The CloudFormation template created by Serverless needs to have no references to the API GW.
- Deploy your project. This will remove the API GW from your CloudFormation stack.
- Undo the changes made in step 1.
- Deploy your project.
This will create a new API GW.
If you were using the API GW URL assigned by AWS then there is no way to get that URL back.
Following way will not retrieve your api gateway url but it will help you redeploy.
- Go to cloudformation in aws console.
- Search for your function here.
- select it and delete your function template.
(It might not delete successfully first time. Try deleting it again, select a checkbox on the popup )
- Do serverless deploy again.
Your api should get deployed properly.