[英]Custom Lambda Authorizer Event Payload type
I am trying to create a custom lambda authorizer with the lambda event payload type as "REQUEST".我正在尝试创建自定义 lambda 授权方,其中 lambda 事件有效负载类型为“REQUEST”。 the serverless.yml is pretty simple serverless.yml 非常简单
functions:
authorizer:
handler: src/authorizer.handler
type: REQUEST
Whenever I deploy this yaml file it creates an authorizer with a TOKEN-based Event Payload instead of REQUEST-based.每当我部署此 yaml 文件时,它都会创建一个授权方,该授权方具有基于令牌的事件负载,而不是基于请求的负载。
The authorizer type should be set below the events
section, like this:授权者类型应设置在events
部分下方,如下所示:
functions:
hello:
handler: handler.hello
events:
- http:
path: /hello
method: get
authorizer:
name: authorizer
type: request
authorizer:
handler: authorizer.handler
You have instead specified the type next to "handler" on the function itself.您已经在 function 本身的“处理程序”旁边指定了类型。 Serverless deploys with a warning if you do this "Warning: Invalid configuration encountered at 'functions.authorizer': unrecognized property 'type'".如果您执行此操作,无服务器部署会发出警告“警告:在‘functions.authorizer’处遇到无效配置:无法识别的属性‘type’”。 It then defaults to "token" as type since no valid type was found.然后它默认为“token”作为类型,因为没有找到有效类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.