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.
| 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.
Why do we return something here if we don't find a default account?
There was a problem hiding this comment.
:( 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