'Why my custom lambda authorizer doesn't trigger?

I created a custom lambda authorizer using CloudFormation. The problem is that authorizer is not getting triggered and it just bypasses any request. My cloudformation code:

Resources:
 CustomAuthFunction:
    Type: AWS::Serverless::Function
    Properties:
      FunctionName: !Sub ${AWS::StackName}-CustomAuthFunction
      Description: Custom auth
      CodeUri: api/custom-authorizer
      Handler: main
 ApiFunctionWithAuthFunction:
    Type: AWS::Serverless::Function
    Properties:
      FunctionName: !Sub ${AWS::StackName}-ApiFunctionWithAuthFunction
      Description: Auth
      CodeUri: api/auth-function
      Handler: main
      Events:
        HttpApiSomeAction:
          Type: HttpApi
          Properties:
            Path: /v1
            Method: GET
            ApiId: !Ref Api
            PayloadFormatVersion: '2.0'
            TimeoutInMillis: 29000
            Auth:
              Authorizer: CustomAuth
 Api:
   Type: AWS::Serverless::HttpApi
   Properties:
    Auth:
        Authorizers:
          CustomAuth:
            FunctionArn: !GetAtt CustomAuthFunction.Arn
            FunctionInvokeRole: !GetAtt CustomAuthFunctionRole.Arn
            Identity:
              Headers:
                - Authorization
            AuthorizerPayloadFormatVersion: 2.0
            EnableSimpleResponses: false

The code to custom auth function can be found on github.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source