【发布时间】:2021-08-29 06:28:43
【问题描述】:
我的 lambda 函数需要更多时间来执行,所以当我增加它时
const postReader_NewPost = new lambda.Function(this, 'PostReader_NewPost', {
code: lambda.Code.fromAsset('lambda'),
runtime: lambda.Runtime.PYTHON_2_7,
handler: 'PostReader_NewPost.handler',
timeout: Duration.seconds(300),
description: "",
environment: {
"DB_TABLE_NAME": table.tableName,
"SNS_TOPIC": topic.topicArn
},
role:role,
});
我收到以下错误
Type 'import("c:/Users/myusername/Documents/GitHub/cdk_polly_website/node_modules/@aws-cdk/core/lib/duration").Duration' is not assignable to type 'import("c:/Users/myusername/Documents/GitHub/cdk_polly_website/node_modules/@aws-cdk/aws-dynamodb/node_modules/@aws-cdk/core/lib/duration").Duration'.
Types have separate declarations of a private property 'amount'.ts(2322)
function.d.ts(68, 14): The expected type comes from property 'timeout' which is declared here on type 'FunctionProps'
我已经在课堂上声明了
import { Duration } from '@aws-cdk/core';
我的 package.json 有以下依赖项
"dependencies": {
"@aws-cdk/aws-apigateway": "^1.88.0",
"@aws-cdk/aws-dynamodb": "^1.88.0",
"@aws-cdk/aws-iam": "^1.88.0",
"@aws-cdk/aws-lambda": "^1.88.0",
"@aws-cdk/aws-lambda-event-sources": "^1.88.0",
"@aws-cdk/aws-sns": "^1.88.0",
"@aws-cdk/aws-sns-subscriptions": "^1.88.0",
"@aws-cdk/core": "1.88.0",
"source-map-support": "^0.5.16"
}
感谢帮助。谢谢
【问题讨论】:
标签: aws-lambda aws-cdk