Serveless deploy don't adds lambda permissions to alias
See original GitHub issueBug Report
Description
After updating to serverless 1.60.4 (from 1.37.1) deployed stack started to return {"message": "Internal server error"}
for all calls.
Tried to run “test” from AWS APIGW “Resources”->“Method” view and got: Thu Dec 26 11:52:32 UTC 2019 : Execution failed due to configuration error: Invalid permissions on Lambda function
Rolled back to 1.37.1 and deploy worked fine.
After some digging in cloud trails found that serveless 1.60.4 didn’t give permissions to the “alias” version of our lambda:
Setup info (parts I thought are relevant):
plugins:
- serverless-plugin-canary-deployments
provider:
name: aws
runtime: python3.6
functions:
- app:
handler: wsgi_handler.handler
timeout: 30
deploymentSettings:
type: AllAtOnce
postTrafficHook: tests
alias: live
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Serveless deploy don't adds lambda permissions to alias #7144
I'm having this same issue using provisionedConcurrency in 1.60.5. serverless configures the alias "provisioned". I'm not using serverless- ...
Read more >Serverless AWS alias plugin
This plugin enables use of AWS aliases on Lambda functions. The term alias must not be mistaken as the stage. Aliases can be...
Read more >Deploying serverless applications gradually
Deploys new versions of your Lambda function, and automatically creates aliases that point to the new version. Gradually shifts customer traffic to the...
Read more >How to create IAM roles for deploying your AWS Serverless app
An in-depth guide to creating production-ready, least privilege IAM roles for deploying your serverless application across multiple AWS ...
Read more >How to setup alias using serverless framework - Stack Overflow
Is there such a feature in serverless to do this? If not how do teams deploy multiple version of the same code without...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@levkaganv I’ve just figured out what the issue is. Basically, the serverless framework changed the way it builds the Lambda Permissions resource. Prior to
v1.60.2
, the resource would look like this:However, from that version onwards, the Lambda permissions for API Gateway are composed as follows:
When the plugin amends the permissions to allow API Gateway executing aliased functions, it looks them up by function name assuming the former structure, and therefore it fails with newer Serverless versions. The fix should be relatively simple, but I cannot give you an ETA (PRs welcome 😄).
@samcon I’m not sure that your issue is related, I believe that it’s just due to ALB events not being supported by the plugin (again, PRs welcome 😅)
@dhelms-bw first of all, thank you very much for your PR, it looks good and I’ll merge it as soon as I get the time to test it in a real environment. You mention that it fixes the issues discussed here, however I’m failing to see how. Can you shed some light?
This issue was solved in
serverless@1.61.0
, so using that version or above should do the trick. However, the plugin is not compatible with functions that have theprovisionedConcurrency
setting enabled, which is something I’ll try to fix shortly.