没有触发无服务器框架自定义Lambda授权者

时间:2020-10-15 14:35:23

标签: lambda frameworks authorization token serverless

因此,我正在使用无服务器框架,并且未触发自定义lambda授权器。当我检查应授权的功能时,API网关控制台会说它没有授权。我也无法在“授权者”下找到我的授权功能。任何指针将不胜感激。

loginUser:
    handler: loginUser.loginUser
    module: src/functions/loginFunction
    events:
      - http:
          path: /user/login
          method: post
          request:
            schema:
              application/json: ${file(src/schema/loginUser_request.json)}

  getCats:
    handler: catCrud.getCats
    module: src/functions/catCrud
    events:
      - http: 
          path: /cat
          method: get
          authoirzer:
            name: authorizeFunc
            identitySource: method.request.header.Authorization
            type: token
  authorizeFunc:
    handler: authorizeFunc.authorizeFunc
    module: src/functions/loginFunction

P.S。我不确定这是否有任何价值,但是我正在使用serverless-python-requirements打包我的lambda,并且authorizeFunc与loginFunction共享相同的模块,因为它们具有相同的库。

1 个答案:

答案 0 :(得分:0)

您在authorizer的{​​{1}}部分中拼写了events

尝试:

serverless.yml