awslabs / aws-solutions-constructs

The AWS Solutions Constructs Library is an open-source extension of the AWS Cloud Development Kit (AWS CDK) that provides multi-service, well-architected patterns for quickly defining solutions
https://docs.aws.amazon.com/solutions/latest/constructs/
Apache License 2.0
1.19k stars 240 forks source link

ApiGatewayToKinesisStreams Allows Setting IntegrationResponse but not MethodResponse #1130

Open shellscape opened 4 weeks ago

shellscape commented 4 weeks ago

https://github.com/awslabs/aws-solutions-constructs/blob/8b30791902e09db2f7c49410a03d5d95ccc2ef51/source/patterns/%40aws-solutions-constructs/aws-apigateway-kinesisstreams/lib/index.ts#L179

This construct allows setting integration responses, but doesn't allow setting method responses, which must be done in tandem. The method response sets the expectation for the parameters that the integration response is allowed to send. Without both, setting responseParameter on the integration response is useless, and will always cause an error at deploy time. That error will resemble:

Resource handler returned message: "Invalid mapping expression specified: Validation Result: warnings : [], errors : [Invalid mapping expression parameter specified: method.response.header.Access-Control-Allow-Origin] (Service: ApiGateway, Status Code: 400, Request ID: cf213ad4-e67e-433f-afb8-39ec66a4bf42)" (RequestToken: f868444f-c9a5-79e1-09d4-656b26fd17dc, HandlerErrorCode: InvalidRequest), Resource handler returned message: "Invalid mapping expression specified: Validation Result: warnings : [], errors : [Invalid mapping expression parameter specified: method.response.header.Access-Control-Allow-Origin] (Service: ApiGateway, Status Code: 400, Request ID: 0e1f56d0-4d45-495b-a9c2-88de04f8d168)" (RequestToken: dfaab290-76bd-682f-37ff-7f2628196f44, HandlerErrorCode: InvalidRequest)

Reproduction Steps

n/a

Error Log

See above

Environment

Other


This is :bug: Bug Report

biffgaut commented 3 weeks ago

Thanks for the heads up, we'll take a look.

biffgaut commented 3 weeks ago

Can you provide a code example giving the error you're describing?