-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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(cli): asset publishing broken cross account #18007
Conversation
In #17668, cross-account S3 asset publishing was broken. The reason is that the `account()` function was always broken, using the default account instead of the target account. However, previously this function was only called in an irrecoverable situation anyway, and its failure would be rare. The recent change also calls this function for logging purposes in a happy-case scenario, but then triggers an error during the logging. Fix the invocation to use the right account. Fixes #17988.
@@ -50,7 +50,15 @@ class PublishingAws implements cdk_assets.IAws { | |||
} | |||
|
|||
public async discoverCurrentAccount(): Promise<cdk_assets.Account> { | |||
return (await this.sdk({})).currentAccount(); | |||
const account = await this.aws.defaultAccount(); | |||
return account ?? { |
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.
Why do we return something here if we don't find a default account?
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.
:( because the contract of the function says it must return something. Not sure how much of an impact this is going to have... fairly sure this won't have any impact but I was trying to be safe and returning a dummy value and seeing what happens in real life.
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
In aws#17668, cross-account S3 asset publishing was broken. The reason is that the `account()` function was always broken, using the default account instead of the target account. However, previously this function was only called in an irrecoverable situation anyway, and its failure would be rare. The recent change also calls this function for logging purposes in a happy-case scenario, but then triggers an error during the logging. Fix the invocation to use the right account. Fixes aws#17988. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
In #17668, cross-account S3 asset publishing was broken.
The reason is that the
account()
function was always broken, using thedefault account instead of the target account. However, previously this
function was only called in an irrecoverable situation anyway, and its
failure would be rare.
The recent change also calls this function for logging purposes in
a happy-case scenario, but then triggers an error during the logging.
Fix the invocation to use the right account.
Fixes #17988.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license