如何解决Serverless框架3中的授权者问题?

Sen*_*hur 9 amazon-web-services node.js serverless-framework serverless

当我使用 Serverless Framework 2 时,我定义了授权者,如下所示。

sample:
  handler: sample.handler
  events:
    - http:
        path: sample
        method: get
        cors: true
        authorizer: verify-token
Run Code Online (Sandbox Code Playgroud)

但无服务器框架 3 不支持它。现在,我收到以下错误。

Incorrect type. Expected "Aws.HttpAuthorizer".yaml-schema: Serverless Framework Configuration
Run Code Online (Sandbox Code Playgroud)

我查看了他们已弃用的文档但我找不到解决方案。如何解决这个问题?

小智 0

似乎无服务器希望您为 AWS REST API 定义 HttpAuthorizer 而不是 Lambda Authorizer

设置的定义位于: https: //raw.githubusercontent.com/lalcebo/json-schema/master/serverless/reference.json

Rest API(V1)实际上更高级。请参阅: https: //docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ApiGateway.htmlhttps://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ApiGatewayV2.html