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

❗Notice: (apigateway): API Gateway released new resource DomainNameV2 causing conflicts in L1 generation #32296

Closed
1 task
GavinZZ opened this issue Nov 26, 2024 · 3 comments · Fixed by #32297
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. p1

Comments

@GavinZZ
Copy link
Contributor

GavinZZ commented Nov 26, 2024

Describe the bug

As a summary, CDK aws-apigateway module had a legacy file called apigatewayv2.ts which includes CDK L1 Constructs from API Gateway V2 resource like CfnDomainNameV2. We've already moved everything here to aws-apigatewayv2 module. However, we had to keep the legacy file for backward compatibility issue and every Constructs in the file were marked as deprecated 5 years ago.

Now API Gateway team has released a new AWS resource called DomainNameV2 in API Gateway. The default CDK generated name would be CfnDomainNameV2 in aws-apigateway module but this name collides with the legacy CfnDomainNameV2 Construct from apigatewayv2.ts file (supposedly for APIGatewayV2).

This is causing the L1 generation tool to fail because the new resource by API Gateway is also caused CfnDomainNameV2.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

The new resource should be generated correctly

Current Behavior

It won't generate because of the name conflicts. We can either

Reproduction Steps

N/A

Possible Solution

  1. have a manual patch to the L1 generation script and we will name the new resource for API Gateway to be something more restricted as CfnApiGatewayDomainNameV2. This is weird and confusing name. More importantly, if API Gateway team decides to introduce more resource under API Gateway but named it V2, we will need to add more manual patches.
  2. delete the legacy apigatewayv2.ts file. We've now introduced aws-apigatewayv2 module and this is where users should use the constructs from. However, this would mean that this is a breaking change to users who're still on legacy code. Good news is that the existing APIGatewayV2::DomainName resource can't deploy with at least one DomainNameConfigurations property (even though this property says not required on CFN documentation, CFN deploy will throw an error). And ApiGateway::DomainNameV2 resource doesn't have the same property so users won't be able to update to the latest CDK version and deploy unknowingly successfully. I also verified that if they update to use the same Construct from aws-apigatewayv2 module, it will generate the exact same output CFN template so it won't cause any resource replacement or downtime.

Additional Information/Context

No response

CDK CLI Version

N/A

Framework Version

No response

Node.js Version

N/A

OS

N/A

Language

TypeScript

Language Version

No response

Other information

No response

@GavinZZ GavinZZ added bug This issue is a bug. p1 @aws-cdk/aws-apigateway Related to Amazon API Gateway labels Nov 26, 2024
@GavinZZ GavinZZ changed the title (apigateway): API Gateway released new resource DomainNameV2 causing conflicts in L1 generation ❗Notice: (apigateway): API Gateway released new resource DomainNameV2 causing conflicts in L1 generation Nov 26, 2024
@GavinZZ
Copy link
Contributor Author

GavinZZ commented Nov 26, 2024

The final solution we decided is to delete apigatewayv2.ts file.

For users who use HTTP API L1 Construct in apigatewayv2.ts (i.e. CfnApiV2), if you upgrade to the latest CDK version and start seeing compilation error like Property 'CfnDomainNameV2' does not exist..., please consider the following steps:

  1. Update the import statements from import * as apigateway from 'aws-cdk-lib/aws-apigateway'; to import * as apigatewayv2 from 'aws-cdk-lib/aws-apigatewayv2';.
  2. Update the deprecated construct names e.g. from CfnApiV2 to CfnApi, from CfnDomainNameV2 to CfnDomainName, etc.
  3. As a verification step, please run cdk diff prior to cdk deploy to make sure that no change or only expected change would occur making sure the resource availability during and after deployment.

This solution will guarantee no resource replacement or update as the generated CloudFormation template should be exactly the same as before.

@GavinZZ GavinZZ pinned this issue Nov 26, 2024
@mergify mergify bot closed this as completed in #32297 Nov 26, 2024
@mergify mergify bot closed this as completed in 4db9565 Nov 26, 2024
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

1 similar comment
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 26, 2024
mazyu36 pushed a commit to mazyu36/aws-cdk that referenced this issue Nov 27, 2024
…odule (aws#32297)

### Issue # (if applicable)

Closes aws#32296

### Reason for this change

As a summary, CDK `aws-apigateway` module had a legacy file called `apigatewayv2.ts` which includes CDK L1 Constructs from API Gateway V2 resource like `CfnDomainNameV2`. We've already moved everything here to aws-apigatewayv2 module. However, we had to keep the legacy file for backward compatibility issue and every Constructs in the file were marked as `deprecated` 5 years ago.

Now API Gateway team has released a new AWS resource called DomainNameV2 in API Gateway. The default CDK generated name would be CfnDomainNameV2 in aws-apigateway module but this name collides with the legacy CfnDomainNameV2 Construct from apigatewayv2.ts file (supposedly for APIGatewayV2).

This is causing the L1 generation tool to fail because the new resource by API Gateway is also caused `CfnDomainNameV2`.

### Description of changes

Delete the deprecated `apigatewayv2.ts` file entirely.

### Description of how you validated changes

Existing users on upgrade won't be able to deploy their template without knowing the change because the property for the `APIGateway::DomainNameV2` resource is different from `APIGatewayV2::DomainName` resource, so the template would be non-deployable.

Verified that if existing users who use `CfnDomainNameV2` from `aws-apigateway` module and update to use the same Construct from `aws-apigatewayv2` module, it will generate the exact same output CFN template so it won't cause any resource replacement or downtime.

There's only 76 users who used `CfnApiV2` from `aws-apigateway` module based on Analytics. All these users were on CDK V1 so if they choose to upgrade to latest version, they need to fix a bunch of breaking changes anyway.

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

BREAKING CHANGE: We will be removing deprecated `APIGatewayV2` constructs from `aws-apigateway` module.

*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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant