-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(aws-apigateway) MockIntegrations with defaulCorsPreflightOptions return statusCode 500 #18297
Comments
Hey @Molaire, This doesn't seem to be an issue with the CDK, but rather CloudFormation or API Gateway. Do you find the same behavior when using the console? |
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
@peterwoodworth the issue is that I suggest to just set |
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: