After CORS preflight kept failing with “missing authentication token” i removed the api gateway manually via the aws console because changing the configuration in my serverless.yml file didn’t seem to change the Gateway configuration anymore.
Now deployment fails with " An error occurred while provisioning your stack: ApiGatewayDeployment1496768353300 - Invalid REST API identifier specified". I understand that this is an error caused by me, but can you hint me into the direction of how to recover from this?
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
Run sls deploy. This should remove the API Gateway from your Cloud Formation stack.
You need to remove all references to it. Have a look at the CloudFormation output from Serverless. It should provide more information about what is using it.
@buggy I comment everything out and have only code below but for some reason it doesn’t update Cloudformation stack. Any idea? I deleted api gateway manually
Don’t look at your serverless.yml file. When you run serverless package it should create a folder .serverless with two cloudformation files. Look at the cloudformation-template-update-stack.json file for any references to your API.
If you try deleting the stack in the AWS console it will typically fail because the deployment bucket has files in it. Remove those files plus files from any other S3 buckets you have and try again. On the second attempt at deleting it will often provide a list of resources that can’t be deleted and ask you if you want to leave them. Say yes and clean them up manually.