[英]Ionic 2 : “Property 'number' does not exist on type 'typeof”
[英]Property 'LambdaProxyIntegration' does not exist on type 'typeof'
在 apigatewayv2-integrations 出現錯誤(屬性 'LambdaProxyIntegration' 在類型 'typeof' 上不存在)我是 aws 雲服務的新手,並試圖創建一個示例項目以供學習並從兩天開始就卡在那里。
import * as cdk from '@aws-cdk/core';
import * as ec2 from '@aws-cdk/aws-ec2';
import * as lambda from '@aws-cdk/aws-lambda';
import * as rds from '@aws-cdk/aws-rds';
import * as apigw from '@aws-cdk/aws-apigatewayv2';
import * as integrations from '@aws-cdk/aws-apigatewayv2-integrations';
export class SampleStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
// Create the VPC needed for the Aurora Serverless DB cluster
const vpc = new ec2.Vpc(this, 'AuroraVPC');
// Create the Serverless Aurora DB cluster; set the engine to Postgres
const cluster = new rds.ServerlessCluster(this, 'AuroraTestCluster', {
engine: rds.DatabaseClusterEngine.AURORA_POSTGRESQL,
parameterGroup: rds.ParameterGroup.fromParameterGroupName(this, 'ParameterGroup', 'default.aurora-postgresql10'),
defaultDatabaseName: 'TestDB',
vpc,
scaling: { autoPause: cdk.Duration.seconds(0) } // Optional. If not set, then instance will pause after 5 minutes
});
// Create the Lambda function that will map GraphQL operations into Postgres
const postFn = new lambda.Function(this, 'MyFunction', {
runtime: lambda.Runtime.NODEJS_12_X,
code: new lambda.AssetCode('lambda-functions'),
handler: 'index.handler',
memorySize: 1024,
environment: {
CLUSTER_ARN: cluster.clusterArn,
SECRET_ARN: cluster.secret?.secretArn || '',
DB_NAME: 'TestDB'
},
});
// Grant access to the cluster from the Lambda function
cluster.grantDataApiAccess(postFn);
// create the API Gateway with one method and path
const api = new apigw.HttpApi(this, 'Endpoint', {
defaultIntegration: new integrations.LambdaProxyIntegration({
handler: postFn
}),
});
new cdk.CfnOutput(this, "HTTP API URL", {
value: api.url ?? "Something went wrong with the deploy",
});
}``
}
從 2021 年 11 月 29 日起不再有LambdaProxyIntegration
,它已移至: HttpLambdaIntegration
Git 提交: https ://github.com/aws/aws-cdk/commit/29039e8bd13a4fdb7f84254038b3331c179273fd 檢查您的軟件包版本並嘗試將其更改為:
new integrations.HttpLambdaIntegration('IntegrationId', handler, {"props": "props"}),
文檔: https ://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-apigatewayv2-integrations.HttpLambdaIntegration.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.