-
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
chore(cdk): use RegionInfo instead of aws-sdk v2 for region domain suffix #31008
Conversation
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.
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.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
…nto dev-region-domain-suffix
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.
This PR lgtm from the perspective of the AWS SDK JS team.
➡️ PR build request submitted to A maintainer must now check the pipeline and add the |
CodeQL Analyser is failing with:
Which is the same issue as in PR #30991 - I am assuming this error is related to the configuration of the test runner rather than anything to do with the code changes in these PRs. |
require('aws-sdk/lib/maintenance_mode_message').suppress = true; | ||
/* eslint-enable @typescript-eslint/no-require-imports */ | ||
|
||
if (!regionUtil.getEndpointSuffix) { |
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.
Our unit tests mock this function so it can be tested. Please remove those mocks and ensure the tests still pass.
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.
Originally I removed this but it caused test/api/logs/logs-monitor.test.ts
to fail.
I have it passing by changing the expected num of stderr errors to 2, and pointing the check of the error content to the second index. Let me know if there's a different approach you would rather I take with this.
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.
So you removed the mock and that caused that test to fail? What did it fail with?
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.
When removing the line require('aws-sdk/lib/maintenance_mode_message').suppress = true;
, the test suite fails with a message that it was expecting one stderr message. I have left the test in that was failing, and have got it to pass by setting it to expect 2 stderr messages
This commit passes the tests without any tests / mocks being removed:
07d4e30
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
The pull request linter fails with the following errors:
PRs must pass status checks before we can provide a meaningful review. If you would like to request an exemption from the status checks or clarification on feedback, please leave a comment on this PR containing |
Closing PR as this is being implemented as part of a larger change to CDK. |
Comments on closed issues and PRs are hard for our team to see. |
Issue #29838
Progresses (not closes) issue #29838
Reason for this change
CDK uses the function getEndpointSuffix in the AWS JavaScript V2 SDK which is not a private function but is not a publicly documented and supported function of the SDK. The SDK maintainers have pointed out that this should not be used. The V2 SDK is entering maintenance mode on 2024-09-08, with end of support on 2025-09-08.
CDK maintains the
region-info
package which can provide thedomainSuffix
property of a region: https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_region-info.RegionInfo.htmlDescription of changes
This change replaces the call to the unsupported
aws-sdk/lib/region_config.getEndpointSuffix
with@aws-cdk/region-info.RegionInfo.get(region).domainSuffix
.Description of how you validated changes
No new unit or integration tests have been added as this does not add or change any functionality. A random integration test has been run to verify this works. When the integration test is run, CDK uses the updated function to work out the S3 URL for the CloudFormation template file. This deploys successfully.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license