Custom authorizors - suddenly not attaching

just noticed that my custom authorizer isn’t even attaching to any of my api gateways anymore.

I thought maybe it was my fancy dynamic arn e.g:

arn:aws:lambda:{self:custom.region}:*:function:security-service-{self:custom.stage}-jwt-authorizer:*

but even after I added it explicitly , its never applied anymore:

anyone have any idea what might have happened ?

# NOTE: update this with your service name
service: store-settings-service

# Use the serverless-webpack plugin to transpile ES6
plugins:
  - serverless-webpack
  - serverless-aws-documentation
  - serverless-reqvalidator-plugin

# Enable auto-packing of external modules
custom:
  webpackIncludeModules: true
  region: "${opt:region, self:provider.region}"
  stage: "${opt:stage, self:provider.stage}"
  documentation:
    # this is general info about the API
    api:
      info:
        version: '1'
        title: Store settings API
        description: Some example API
        termsOfService: https://www.google.com
        contact:
          name: hghghg
          url: https://www.serverless.com/framework
          email: bvbbvalsh@gmail.com
        license:
          name: The license
          url: https://www.github.com
      tags:
        -
          name: api
          description: The first tag

    # Now we describe all the models that we use
    models:
      -
        name: StoreSettingsRequestModel
        contentType: "application/json"
        schema:
          type: object
          properties:
            d:
              type: object

          required: [d]



provider:
  name: aws
  runtime: nodejs6.10
  stage: dev
  region: us-east-1

  environment: ${file(../env.yml):${self:custom.stage}}


  iamRoleStatements:
    - Effect: Allow
      Action:
        - lambda:InvokeFunction
      Resource: "*"
    - Effect: Allow
      Action:
        - dynamodb:DescribeTable
        - dynamodb:Query
        - dynamodb:Scan
        - dynamodb:GetItem
        - dynamodb:PutItem
        - dynamodb:UpdateItem
        - dynamodb:DeleteItem
      Resource: "arn:aws:dynamodb:us-east-1:*:*"

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          path: hello
          method: get


  store-settings-get:
      handler: get.main
      events:
        - http:
            path: store-settings/{storeId}/{name}
            method: get
            cors: true
            authorizor: arn:aws:lambda:us-east-1:xxxxxxx:function:security-service-dev-jwt-authorizer

  store-settings-update:
      handler: update.main
      events:
        - http:
            path: store-settings/update/{storeId}/{name}
            method: put
            cors: true
            authorizor: arn:aws:lambda:us-east-1:xxxxxxx:function:security-service-dev-jwt-authorizer
            reqValidatorName: bodyValidator
            documentation:
              summary: Takes a request body
              tags:
                - Tag2
              description: Demonstrates a POST method.
              requestModels:
                 "application/json": StoreSettingsRequestModel


resources:
  Resources:
    bodyValidator:
      Type: "AWS::ApiGateway::RequestValidator"
      Properties:
        Name: 'only-body'
        RestApiId:
          Ref: ApiGatewayRestApi
        ValidateRequestBody: true
        ValidateRequestParameters: true            

(before you delete, make sure you have backup your data)

Can you destroy and recreare it, will it fix your problem?

removed and redeployed them all - same thing, no trace of any connected authorizers - this framework sometimes wtf :frowning:

finally

I just realized i spelled ‘authorizor’ instead of ‘authorizer’ … jfc

1 Like