Request type custom authorizer issue in serverless framework

I always get 403 forbidden all the time. Here’s the github code

Serverless URL: https://hr4nwgnf96.execute-api.ap-southeast-2.amazonaws.com/dev/hello?auth=yes

Sam URL: https://7jjym0ms9g.execute-api.ap-southeast-2.amazonaws.com/dev/hello?auth=yes

You can test both URL's above in postman and clearly see that 
 - sam url is working fine  
 - serverless framework url always returning 403

Serverless template:

service: sls-api-gateway-request-auth
frameworkVersion: '3'
configValidationMode: error

provider:
  name: aws
  region: ap-southeast-2
  runtime: nodejs14.x
  timeout: 30

functions:
  authFunction:
    handler: ./auth.lambda_handler

  backendFunction:
    handler: ./backend.lambda_handler
    runtime: nodejs14.x
    events:
      - http:
          method: get
          cors: true
          path: /auth
          authorizer:
            name: authFunction
            type: request

  Outputs:
    MyApiAuth:
      Description: "API Gateway endpoint URL for dev stage for api key validation in query string"
      Value: !Sub "https://{sls:instanceId}.execute-api.${AWS::Region}.amazonaws.com/dev/hello?auth=yes"

Here’s the SAM template which is working fine:

AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'

Resources:

  MyApi:
    Type: AWS::Serverless::Api
    Properties:
      StageName: dev
      Auth:
        DefaultAuthorizer: MyLambdaRequestAuthorizer
        Authorizers:
          MyLambdaRequestAuthorizer:
            FunctionPayloadType: REQUEST
            FunctionArn: !GetAtt authFunction.Arn
            Identity:
              QueryStrings:
                - auth
              ReauthorizeEvery: 100

  backendFunction:
    Type: 'AWS::Serverless::Function'
    Properties:
      Handler: backend.lambda_handler
      Runtime: nodejs10.x
      CodeUri: .
      Events:
        HelloAPI:
          Type: Api
          Properties:
            RestApiId: !Ref MyApi
            Path: /hello
            Method: GET

  authFunction:
    Type: 'AWS::Serverless::Function'
    Properties:
      CodeUri: .
      Handler: auth.lambda_handler
      Runtime: nodejs10.x

Outputs:
  ApiUrl:
    Description: "API endpoint URL"
    Value: !Sub 'https://${MyApi}.execute-api.${AWS::Region}.amazonaws.com/dev/hello?auth=yes'

I want this to be implemented using serverless framework. I am not sure why it isn’t working. I followed what ever is mentioned in official docs. Did I miss anything?

I recently added a request authorizer to my Serverless template and it was not nearly as straight forward as the docs would have you believe.

First, in Serverless the type is CUSTOM not request when you want a request type authorizer. Second, to convince Serverless that your authorizer really is a request authorizer and should not be a token authorizer, you need to define the authorizer in the Resources section of the template. Something like:

    AuthFunctionApiGatewayAuthorizer:
      Type: "AWS::ApiGateway::Authorizer"
      Properties:
        Name: authAuthorizer
        RestApiId:
          Ref: ApiGatewayRestApi
        AuthorizerUri:
          "Fn::Join":
            - ""
            - - "arn:"
              - Ref: "AWS::Partition"
              - ":apigateway:"
              - Ref: "AWS::Region"
              - ":lambda:path/2015-03-31/functions/"
              - Fn::GetAtt:
                  - AuthFunctionLambdaFunction
                  - Arn
              - "/invocations"
        Type: REQUEST
        AuthorizerResultTtlInSeconds: 0
        IdentitySource: ""

That was the only way I got it properly working.

First, in Serverless the type is CUSTOM not request
You mean to say this should be like:

authorizer:
    name: authFunction
    type: custom

But the docs here says it should be type: request. See the attached screenshot

Can you please provide any link to docs you found?

I can’t provide any relevant documentation for it. This comes from various examples and lots of trial and error. However, it just occurred to me we may not be talking about the same version. I know I’m a little behind on Serverless versions, which version are you using?