首页 > 解决方案 > aws-apigateway RestApi deployOptions 失败

问题描述

所以我有一个问题,我可以使用以下声明创建一个 REST API

const restApi = new apigw.RestApi(this, 'Api_Name_Here', {
      description: 'API Description'
    });

我可以进行 cdk 部署,一切都很好。但是,当我添加 deployOptions 以指定阶段名称时,像这样

const restApi = new apigw.RestApi(this, 'Api_Name_here', {
      description: 'API Description',
      deployOptions: {
        stageName: 'dev'
      }
    });

它失败了,出现以下错误

The final policy size (20806) is bigger than the limit (20480). (Service: AWSLambda; Status Code: 400; Error Code: PolicyLengthExceededException; Request ID: 4d13d438-93ab-441b-bf32-c7a0a442693e)
   Function.addPermission (D:\proj\testing\restApi\cdk\node_modules\@aws-cdk\aws-lambda\lib\function-base.ts:191:5)
   // snipped

我可以做些什么来缩短生成的任何策略,或者我可以以某种方式将其分解?

标签: aws-cdk

解决方案


推荐阅读