Skip to content
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

[api-gateway] RestApi construct does not automatically create new deployments after addGatewayResponse #10963

Closed
keabarnes opened this issue Oct 19, 2020 · 3 comments · Fixed by #11068
Assignees
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. effort/small Small work item – less than a day of effort p1

Comments

@keabarnes
Copy link

keabarnes commented Oct 19, 2020

When calling the addGatewayResponse method on a RestApi, any GatewayResponse added doesn't come into effect because it doesn't trigger a new deployment. Manually creating a new deployment through AWS UI fixes this.

Similar to #8024
Related: #5354 (comment)

Reproduction Steps

First deploy:

    const restApi = new RestApi(this,"MyRestApi");

    const restNotes = restApi.root.addResource("notes");
    restNotes.addMethod(HttpMethod.GET, ...);

Subsequent deploy:

    const restApi = new RestApi(this,"MyRestApi");

    restApi.addGatewayResponse("4xxGatewayResponse", {
      type: ResponseType.DEFAULT_4XX,
      responseHeaders: {
        "Access-Control-Allow-Origin": "'*'",
        "Access-Control-Allow-Headers": "'*'",
      },
    });

    const restNotes = restApi.root.addResource("notes");
    restNotes.addMethod(HttpMethod.GET, ...);

What did you expect to happen?

A change in the GatewayResponse for an API should trigger a deployment, as that's what's required when using the UI.

What actually happened?

No new deployment was created when the GatewayResponse resource was changed.

Environment

  • CLI Version :1.51.0
  • Framework Version: 1.53.0
  • Node.js Version: 10.16.3
  • OS : MacOS
  • Language (Version): TypeScript (3.9.6)

This is 🐛 Bug Report

@keabarnes keabarnes added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 19, 2020
@github-actions github-actions bot added the @aws-cdk/aws-apigateway Related to Amazon API Gateway label Oct 19, 2020
@keabarnes
Copy link
Author

I haven't had the time to create a minimal reproduction of the error and have only observed this issue through debugging of my current project.

nija-at pushed a commit that referenced this issue Oct 23, 2020
…ployment

The auto deployment feature is implemented by recording changes to the
RestApi and replacing the AWS::ApiGateway::Deployment resource on any
changes.

The GatewayResponse construct was not registered, and hence no
deployments occurred on changes to this.

fixes #10963
@nija-at
Copy link
Contributor

nija-at commented Oct 23, 2020

Thanks for reporting. The fix is posted here - #11068

@nija-at nija-at added effort/small Small work item – less than a day of effort p1 and removed needs-triage This issue or PR still needs to be triaged. labels Oct 23, 2020
@mergify mergify bot closed this as completed in #11068 Oct 29, 2020
mergify bot pushed a commit that referenced this issue Oct 29, 2020
…ployment (#11068)

The auto deployment feature is implemented by recording changes to the
RestApi and replacing the AWS::ApiGateway::Deployment resource on any
changes.

The GatewayResponse construct was not registered, and hence no
deployments occurred on changes to this.

fixes #10963


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. effort/small Small work item – less than a day of effort p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants