(aws-apigateway) MockIntegrations with defaulCorsPreflightOptions return statusCode 500 #18297
Labels
@aws-cdk/aws-apigateway
Related to Amazon API Gateway
bug
This issue is a bug.
closed-for-staleness
This issue was automatically closed because it hadn't received any attention in a while.
needs-cfn
This issue is waiting on changes to CloudFormation before it can be addressed.
needs-triage
This issue or PR still needs to be triaged.
p2
response-requested
Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
What is the problem?
If an API Gateway Resource allow CORS with defaultCorsPreflightOptions in its options, hitting its child methods that are MockIntegrations will fail with a Internal Error message (statusCode: 500)
This can be manually fixed by setting PassthroughBehavior.NEVER for the Integration request in CDK or the console.
Reproduction Steps
What did you expect to happen?
I expected MockIntegration methods to work beside the LambdaIntegration methods, even with CORS enabled by default.
What actually happened?
Only the LambdaIntegration works, not the MockIntegration methods.
They work when testing through the API Gateway test option in the console, but not when hitting them with my browser, implying it's a problem with CORS/OPTIONS.
CDK CLI Version
2.4.0 (build 993f14d)
Framework Version
No response
Node.js Version
v16.13.1
OS
Ubuntu 21.10
Language
Typescript
Language Version
No response
Other information
A workaround is to set defaultCorsPreflightOptions to undefined for the resources with MockIntegration and manually add the method OPTIONS with passthroughBehavior: PassthroughBehavior.NEVER.
The text was updated successfully, but these errors were encountered: