Api-gateway

As at time of writing (Apr 2021), configuring api-gateway with api keys and usage plans is bugged according to the official docs. The docs say to put configuration in provider.apigateway, instead of under provider directly.

However, this does not work, and you must place them under provider (the deprecated behaviour) instead.

Errors During sls deploy

Sometimes, deploying the cloud formation stack fails with errors such as “stack not found”.

The error messages are horrible; errors in the serverless.yml file could cause it. This is probably caused by the error causing the stack creation to fail, resulting in subsequent commands not being able to use it.

Check Lambda Permissions

aws iam get-role-policy --role-name <function role> --policy-name <policy name>
 
# to get the function role
aws lambda get-function --function-name <function>
 
# to get policy name
aws iam list-role-policies --role-name <role>