Skip to content

fix(apigateway): race condition exists between stage and cfnaccount in specrestapi - #22671

Merged
mergify[bot] merged 5 commits into
aws:mainfrom
nwinans:main
Oct 28, 2022
Merged

mergify[bot] merged 5 commits into
aws:mainfrom
nwinans:main

Conversation

@nwinans

@nwinans nwinans commented Oct 27, 2022 •

Copy link
Copy Markdown
Contributor

This PR is based off of #18011, which fixed a race condition between RestApi stages and CloudWatch roles. The mentioned PR fixed the issue for RestApi, but not SpecRestApi, which this PR aims to fix.

The fix was largely implemented in RestApiBase. Since SpecRestApi inherits the same RestApiBase as RestApi, all we need to do is swap the order of resource creation so that the CloudWatch role is created before the RestApi stage, and can be attached correctly.

This PR also updates the integration tests to reflect the new dependency RestApi stage has on RestApi account.

Fixes #18925

All Submissions:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io

gitpod-io Bot commented Oct 27, 2022

Copy link
Copy Markdown

@aws-cdk-automation
aws-cdk-automation requested a review from a team October 27, 2022 16:50
@github-actions github-actions Bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. p1 labels Oct 27, 2022

@aws-cdk-automation aws-cdk-automation left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

@nwinans

nwinans commented Oct 27, 2022

Copy link
Copy Markdown
Contributor Author

I think an exemption to the linter error should be granted for this package. The actual integration tests themselves don't need to be touched given the nature of the bug fix, but the relevant integration test snapshots have been updated to reflect the behavior of the API.

@TheRealAmazonKendra

Copy link
Copy Markdown
Contributor

I think an exemption to the linter error should be granted for this package. The actual integration tests themselves don't need to be touched given the nature of the bug fix, but the relevant integration test snapshots have been updated to reflect the behavior of the API.

That't reasonable. Providing the exemption.

@TheRealAmazonKendra TheRealAmazonKendra added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Oct 27, 2022
@aws-cdk-automation
aws-cdk-automation dismissed their stale review October 27, 2022 17:08

✅ Updated pull request passes all PRLinter validations. Dissmissing previous PRLinter review.

@TheRealAmazonKendra

Copy link
Copy Markdown
Contributor

@Mergifyio update

@mergify

mergify Bot commented Oct 27, 2022

Copy link
Copy Markdown
Contributor

update

✅ Branch has been successfully updated

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the limited updates to the integ test output, it doesn't look like the tests were actually run. Please revert the output of the integ tests and then run yarn integ --update-on-failed and commit the output.

@mergify
mergify Bot dismissed TheRealAmazonKendra’s stale review October 28, 2022 17:54

Pull request has been modified.

@mergify

mergify Bot commented Oct 28, 2022

Copy link
Copy Markdown
Contributor

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@TheRealAmazonKendra TheRealAmazonKendra changed the title fix(apigateway): racecondition between stage and cfnaccount in specrestapi fix(apigateway): race condition exists between stage and cfnaccount in specrestapi Oct 28, 2022
@aws-cdk-automation

Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 4e30681
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
mergify Bot merged commit 4cb008b into aws:main Oct 28, 2022
@mergify

mergify Bot commented Oct 28, 2022

Copy link
Copy Markdown
Contributor

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

ali-n4i pushed a commit to ali-n4i/aws-cdk that referenced this pull request Jul 29, 2026
…n specrestapi (aws#22671)

This PR is based off of aws#18011, which fixed a race condition between RestApi stages and CloudWatch roles. The mentioned PR fixed the issue for RestApi, but not SpecRestApi, which this PR aims to fix. 

The fix was largely implemented in RestApiBase. Since SpecRestApi inherits the same RestApiBase as RestApi, all we need to do is swap the order of resource creation so that the CloudWatch role is created before the RestApi stage, and can be attached correctly. 

This PR also updates the integration tests to reflect the new dependency RestApi stage has on RestApi account. 

Fixes aws#18925

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. p1 pr-linter/exempt-integ-test The PR linter will not require integ test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-apigateway): race condition between Stage and CfnAccount on SpecRestApi

4 participants