@@ -812,7 +812,7 @@ export class Deployments {
812812 const { manifest, stackEnv } = await this . prepareAndValidateAssets ( asset , options ) ;
813813 await publishAssets ( manifest , this . sdkProvider , stackEnv , {
814814 ...options . publishOptions ,
815- allowCrossAccount : await this . allowCrossAccountAssetPublishingForEnv ( stackEnv ) ,
815+ allowCrossAccount : await this . allowCrossAccountAssetPublishingForEnv ( options . stack ) ,
816816 } ) ;
817817 }
818818
@@ -852,15 +852,15 @@ export class Deployments {
852852 // No need to validate anymore, we already did that during build
853853 const publisher = this . cachedPublisher ( assetManifest , stackEnv , options . stackName ) ;
854854 // eslint-disable-next-line no-console
855- await publisher . publishEntry ( asset , { allowCrossAccount : await this . allowCrossAccountAssetPublishingForEnv ( stackEnv ) } ) ;
855+ await publisher . publishEntry ( asset , { allowCrossAccount : await this . allowCrossAccountAssetPublishingForEnv ( options . stack ) } ) ;
856856 if ( publisher . hasFailures ) {
857857 throw new Error ( `Failed to publish asset ${ asset . id } ` ) ;
858858 }
859859 }
860860
861- private async allowCrossAccountAssetPublishingForEnv ( env : cxapi . Environment ) : Promise < boolean > {
861+ private async allowCrossAccountAssetPublishingForEnv ( stack : cxapi . CloudFormationStackArtifact ) : Promise < boolean > {
862862 if ( this . _allowCrossAccountAssetPublishing === undefined ) {
863- const sdk = ( await this . cachedSdkForEnvironment ( env , Mode . ForReading ) ) . sdk ;
863+ const { stackSdk : sdk } = await this . prepareSdkFor ( stack , undefined , Mode . ForReading ) ;
864864 this . _allowCrossAccountAssetPublishing = await determineAllowCrossAccountAssetPublishing ( sdk , this . props . toolkitStackName ) ;
865865 }
866866 return this . _allowCrossAccountAssetPublishing ;
0 commit comments