[英]Serverless Framework custom lambda authorizer is not being triggered
So I am using the Serverless Framework and the custom lambda authorizer is not being triggered.所以我使用的是无服务器框架,并且没有触发自定义 lambda 授权器。 When I check the function that should be authorized, the API Gateway console says it has no authorization.
当我检查应该授权的功能时,API网关控制台说它没有授权。 I also can't find my authorization function under Authorizers.
我也无法在 Authorizers 下找到我的授权功能。 Any pointers would be appreciated.
任何指针将不胜感激。
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
PS I am not sure if this is of any value, but I am using the serverless-python-requirements for packaging up my lambdas and the authorizeFunc is sharing the same module with the loginFunction because they have the same libs. PS 我不确定这是否有任何价值,但我使用 serverless-python-requirements 来打包我的 lambdas,并且 authorizeFunc 与 loginFunction 共享相同的模块,因为它们具有相同的库。
You misspelled authorizer
in the events
section of your serverless.yml
.您在
serverless.yml
的events
部分拼错了authorizer
。
Try:尝试:
getCats:
handler: catCrud.getCats
module: src/functions/catCrud
events:
- http:
path: /cat
method: get
authorizer:
name: authorizeFunc
identitySource: method.request.header.Authorization
type: token
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.