serverless-heaven / serverless-aws-alias

Alias support for Serverless 1.x
MIT License
189 stars 68 forks source link

Issue when using custom authorizers with serverless-pseudo-parameters plugin #112

Closed aleksdikanski closed 6 years ago

aleksdikanski commented 6 years ago

Hi,

I stumbled upon this today: when using the serverless-pseudo-parameters plugin, the custom authorizer support breaks.

An error occurred: AuthorizerApiGatewayAuthorizerdev - Invalid Authorizer URI: :${stageVariables.SERVERLESS_ALIAS}arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:811794430790:function:authorizer/invocations. Authorizer URI should be a valid API Gateway ARN that represents a Lambda function invocation..

Reason seems to be that the pseudo parameters plugin replaces the direct arn reference of the lambda arn:aws:lambda: .... with a call to Cloudformation Fn::Sub function (as intented). This break the detection of the custom authorizer as I implemented it.

...
{
   "Fn::Sub": "arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:authorizer"
},
...

I created a Pull Request to fix this.