customerId
作为缓存键这样的端点。有效地,在AWS控制台上,部署后应该看起来像这样:,但这是我目前得到的:
的REST API 和我的方法配置:
methods.addMethod('GET', new LambdaIntegration(lambda), {
authorizer: requestAuthorizer,
requestValidator: requestParamValidator,
requestParameters: {
'method.request.path.customerId': true,
},
methodResponses: [
{
statusCode: '200',
},
{
statusCode: '404',
},
{
statusCode: '401',
},
],
});
我尝试添加这样的参数:
cacheKeyParameters
或在我的内部methods.addMethod('GET', new LambdaIntegration(lambda), {
authorizer: requestAuthorizer,
requestValidator: requestParamValidator,
cacheKeyParameters: ['method.request.path.customerId'],
requestParameters: {
'method.request.path.customerId': true,
},
methodResponses: [
{
statusCode: '200',
},
{
statusCode: '404',
},
{
statusCode: '401',
},
],
});
中显示了我显示的
methodOptions
,但是我得到了这个编译错误:deployOptions
即使我用 @ts-ignore忽略了这一点,它也行不通,结果仍然是:
Object literal may only specify known properties, and cacheKeyParameters does not exist in type MethodOptions
myMethod.addPropertyOverride('CacheKeyParameters', [
'method.request.path.customerId',
]);
但是,部署失败了:
myMethod.addPropertyOverride('cacheKeyParameters', [
'method.request.path.customerId',
]);
或
[#: extraneous key [CacheKeyParameters] is not permitted]
这很有意义,因为
CDK文档的方法是没有Cache-Keyparameters或任何与缓存相关的参数。但是,我该怎么做?甚至没有Chatgpt O1可以帮助我解决这个XD
API Gateway的集成对象上存在cache键参数,而不是显示的方法对象HEREY