Serverless Framework Deployment failing after deleting API Gateway on AWS

less than 1 minute read

Now deployment fails with “ An error occurred while provisioning your stack: ApiGatewayDeployment1496768351111 - Invalid REST API identifier specified”.

It turned out that the API Gateway ID is automatically generated by Amazon and my cloudformation template still retained the id. Yet the id is missing now.

The remedy is to remove the http event triggers from every Lambda. If you have any other references to the API Gateway in your serverless.yml then remove those too. This should remove the API Gateway from your Cloud Formation template. You can check by looking at .serverless/cloudformation-template-update-stack.json

Then create the http event triggers again and do sls deploy. It’ll recreate those endpoints.