aws / aws/aws-cdk

(apigatewayv2) Support abstraction for responseParameters

Open
#20,993 9 comments 5 reactions 0 assignees View on GitHub
@aws-cdk/aws-apigatewayv2-integrations effort/medium feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

**Having the following cdk code:**
`
this._webLambdaProxyIntegration = new CfnIntegration(this, ``, {
payloadFormatVersion: apiGateway.PayloadFormatVersion.VERSION_1_0.version,
apiId: this.webAPI.apiId,
integrationType: apiGateway.HttpIntegrationType.AWS_PROXY,
integrationMethod: apiGateway.HttpMethod.ANY,
integrationUri: cfnAlias.ref,
responseParameters: {"403" : {"overwrite:statuscode" : "401"}}
});
`

**which produces the following template:**
`
"Integration": {
"Type": "AWS::ApiGatewayV2::Integration",
"Properties": {
"ApiId": {
"Ref": "API327D3D35"
},
"IntegrationType": "AWS_PROXY",
"IntegrationMethod": "ANY",
"IntegrationUri": {
"Ref": "AliasBC47D6CA"
},
"PayloadFormatVersion": "1.0",
"ResponseParameters": {
"403": {
"overwrite:statuscode": "401"
}
}
},
"Metadata": {
"aws:cdk:path": ""
}
},
`

**fails during deployment with the following error:**
Property validation failure: [Encountered unsupported properties in {/ResponseParameters/403}: [overwrite:statuscode]]

**Stack trace:**
failed: Error: The stack named failed to deploy: UPDATE_ROLLBACK_COMPLETE: Property validation ailure: [Encountered unsupported properties in {/ResponseParameters/403}: [overwrite:statuscode]]
failure: [Encountered unsupported properties in {/ResponseParameters/403}: [overwrite:statuscode]]
at prepareAndExecuteChangeSet (\node_modules\aws-cdk\lib\api\deploy-stack.ts:385:13)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at CdkToolkit.deploy (\node_modules\aws-cdk\lib\cdk-toolkit.ts:209:24)
at initCommandLine (\node_modules\aws-cdk\lib\cli.ts:341:12)

**Cdk version used**
`
"@aws-cdk/aws-apigatewayv2-alpha": "2.23.0-alpha.0",
"@aws-cdk/aws-apigatewayv2-authorizers-alpha": "2.23.0-alpha.0",
"@aws-cdk/aws-apigatewayv2-integrations-alpha": "2.23.0-alpha.0",
"aws-cdk": "2.23.0",
"aws-cdk-lib": "2.23.0",
"constructs": "10.1.6",
`

### Expected Behavior

ResponseParameters mapping to deploy.

### Current Behavior

fails to deploy

### Reproduction Steps

deploy integration with responseParameters mapping

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CDK CLI Version

2.23.0 (build 50444aa)

### Framework Version

na

### Node.js Version

14.19.0

### OS

windows

### Language

Typescript

### Language Version

4.5.5

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at the CfnIntegration responseParameters entry point and inspect how the 403 mapping is represented in the generated AWS::ApiGatewayV2::Integration template. Compare that representation with the supported API Gateway response-parameter shape; done when a responseParameters mapping synthesizes to a deployable template without the unsupported-property validation error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
api, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.