-
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
fix(apigateway): unable to enable cors with a root proxy and LambdaRestApi #5249
Conversation
Thanks so much for taking the time to contribute to the AWS CDK ❤️ We will shortly assign someone to review this pull request and help get it
|
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding these tests as a mechanism of repro!
Unfortunately, this can't be merged into our code base as is.
Do you intend to update this PR with the fix for this issue, or was your intention to simply provide a repro?
@nija-at Understood. I have not looked into the solution but this PR could be updated to include a fix. |
Thanks so much for taking the time to contribute to the AWS CDK ❤️ We will shortly assign someone to review this pull request and help get it
|
2 similar comments
Thanks so much for taking the time to contribute to the AWS CDK ❤️ We will shortly assign someone to review this pull request and help get it
|
Thanks so much for taking the time to contribute to the AWS CDK ❤️ We will shortly assign someone to review this pull request and help get it
|
@nija-at I'll pick this up. |
Pull request has been modified.
Title does not follow the guidelines of Conventional Commits. Please adjust title before merge. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thanks so much for taking the time to contribute to the AWS CDK ❤️ We will shortly assign someone to review this pull request and help get it
|
Title does not follow the guidelines of Conventional Commits. Please adjust title before merge. |
Thanks so much for taking the time to contribute to the AWS CDK ❤️ We will shortly assign someone to review this pull request and help get it
|
Title does not follow the guidelines of Conventional Commits. Please adjust title before merge. |
Thanks so much for taking the time to contribute to the AWS CDK ❤️ We will shortly assign someone to review this pull request and help get it
|
Title does not follow the guidelines of Conventional Commits. Please adjust title before merge. |
If a proxy resource is added to the root, it will reflect any `addMethod` calls to the root resource, which causes two OPTIONS methods to be created when CORS is specified (one directly against the root resource and one by the proxy). This uncovered a more general bug where if the proxy resource was added to the root, and the root already included a method of a certain kind, we will get a duplicate. The fix is to avoid the proxy `addMethod` reflection on the root in case there is already a method by that type on the root. This, indirectly, also fixes #5232, where CORS cannot be used with `LambdaRestApi`, which is basically a root proxy.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
If a proxy resource is added to the root, it will reflect any
addMethod
calls to the root resource, which causes two OPTIONS methods to be created when CORS is specified (one directly against the root resource and one by the proxy).This uncovered a more general bug where if the proxy resource was added to the root, and the root already included a method of a certain kind, we will get a duplicate.
The fix is to avoid the proxy
addMethod
reflection on the root in case there is already a method by that type on the root.This, indirectly, also fixes #5232, where CORS cannot be used with
LambdaRestApi
, which is basically a root proxy.