Does HttpApi 2.0 support "lambda" custom authorizers?

I’m using API Gateway v2 HTTP API and following this documentation

I keep getting the following error whenever I try to create a lambda request authorizer

Error: The CloudFormation template is invalid: [/Resources/HttpApiAuthorizerCustomAuthorizer/Type/IdentitySource/0] ‘null’ values are not allowed in templates

# serverless.yml
provider:
  httpApi:
    authorizers:
      customAuthorizer:
        type: request
        functionName: authorizerFunc

functions:
  authorizerFunc:
    name: authorizer-${opt:account}-${opt:stage}
    handler: authorizer.handler
    package:
      include:
        - ./authorizer.js

  helloWorld:
    name: helloWorld-${opt:account}-${opt:stage}
    package:
      include:
        - ./helloWorld.js
    handler: helloWorld.handler
    events:
      - httpApi:
          path: /hello
          method: "*"
          authorizer:
            name: customAuthorizer

If I add the identitySource under the customAuthorizer, it will error out with something JWT related… which is not what I want:

Error: The CloudFormation template is invalid: [/Resources/HttpApiAuthorizerCustomAuthorizer/Type/JwtConfiguration/Audience/0] ‘null’ values are not allowed in templates

My template is the same as the documentation, but it is still treated like it only supports JWT authorizers

1 Like

did u got the solution as i am stuck with same issue

Hello,

This is the working serverless.yml file that I have:

# serverless.yml
frameworkVersion: "3.7.5"

provider:
  name: aws
  runtime: nodejs14.x
  region: ${self:custom.region}
  stage: ${self:custom.stage}
  httpApi:
    cors: true
    authorizers:
      customAuthorizer:
        type: request
        functionName: authorizerFunc
        enableSimpleResponses: true

functions:
  authorizerFunc:
    handler: src/authorizers/authorizer.handler

  myCode:
    handler: src/handlers/my-code.handler
    events:
      - httpApi:
          path: /my-code
          method: POST
          authorizer:
            name: customAuthorizer