Breaking change introduced for Custom Authorizer Lambdas
See original GitHub issueBug Report
Merged PR https://github.com/serverless/serverless/commit/38f6ac125e54d927871b4e5f5b387e0d4c28a6a7 introduced breaking changes for lambda based custom authorizer.
Description
Given I am running serverless v1.60.5
When I run sls deploy
Then the deploy fails because the “cloudformation-template-update-stack.json” file has an incorrect datatype in place for the FunctionName of the Authorizerr Function
Error: An error occurred: CustomAuthorizerLambdaPermissionApiGateway - Value of property FunctionName must be of type String.
Source code that changed https://github.com/serverless/serverless/blob/38f6ac125e54d927871b4e5f5b387e0d4c28a6a7/lib/plugins/aws/package/compile/events/apiGateway/lib/permissions.js commit #38f6ac1
Resultant Cloudformation code showing that FunctionName isn’t a String variable:
"CustomAuthorizerLambdaPermissionApiGateway": {
"Type": "AWS::Lambda::Permission",
"Properties": {
"FunctionName": {
"Fn::Join": [
":",
[
{
"Fn::GetAtt": [
"CustomAuthorizerLambdaFunction",
"Arn"
]
}
]
],
"Fn::GetAtt": [
"CustomAuthorizerLambdaFunction",
"Arn"
]
},
- What did you do? Updated serverless from v1.59.3 to v1.60.5
- What happened? Deploys started to fail because the CustomAuthorizer function could not be deployed
- What should’ve happened? It should have delpoyed, like it previously had done for the past 18 months.
- What’s the content of your
serverless.yml
file? Pasting in the relevant data:
frameworkVersion: ">=1.1.0 <2.0.0"
provider:
name: aws
runtime: python3.7
stage: ${opt:stage,'dev'}
region: eu-west-1
tracing:
lambda: true
apiGateway: true
plugins:
- serverless-python-requirements
- serverless-stage-manager
- serverless-prune-plugin
functions:
customAuthorizer:
handler: authorizer.auth
events:
- http:
path: /auth
method: GET
cors: true
- What’s the output you get when you use the
SLS_DEBUG=*
environment variable (e.g.SLS_DEBUG=* serverless deploy
) Serverless Error ---------------------------------------
An error occurred: CustomAuthorizerLambdaPermissionApiGateway - Value of property FunctionName must be of type String.
Get Support -------------------------------------------- Docs: docs.serverless.com Bugs: github.com/serverless/serverless/issues Issues: forum.serverless.com
Your Environment Information --------------------------- Operating System: darwin Node Version: 11.13.0 Framework Version: 1.60.5 Plugin Version: 3.2.7 SDK Version: 2.2.1 Components Core Version: 1.1.2 Components CLI Version: 1.4.0
Similar or dependent issues: The change to the relevant code was introduced as a result of the PR raised from issue:
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (6 by maintainers)
The patch works for fixing the issue of being able to deploy. Approved.
With regards to the customAuthorizer error I’m getting, I will raise another issue if i need to. I need to spend more time troubleshooting it.
Thanks @medikoo
@DrColza sorry, but it’s not clear for me from above description, whether you’re still facing any issues (?)
If you feel given fix is not sufficient can you explain why, and post an exact error you’re receiving?