@@ -33,6 +33,9 @@ export class SagemakerSpace {
3333 }
3434
3535 public updateSpace ( spaceApp : SagemakerSpaceApp ) {
36+ if ( ! this . spaceApp . App ) {
37+ this . spaceApp . App = spaceApp . App
38+ }
3639 this . setSpaceStatus ( spaceApp . Status ?? '' , spaceApp . App ?. Status ?? '' )
3740 // Only update RemoteAccess property to minimize impact due to minor structural differences between variables
3841 if ( this . spaceApp . SpaceSettingsSummary && spaceApp . SpaceSettingsSummary ?. RemoteAccess ) {
@@ -106,13 +109,21 @@ export class SagemakerSpace {
106109 DomainId : this . spaceApp . DomainId ,
107110 SpaceName : this . spaceApp . SpaceName ,
108111 } )
109-
110- const app = await this . client . describeApp ( {
111- DomainId : this . spaceApp . DomainId ,
112- AppName : this . spaceApp . App ?. AppName ,
113- AppType : this . spaceApp ?. SpaceSettingsSummary ?. AppType ,
114- SpaceName : this . spaceApp . SpaceName ,
115- } )
112+ let app
113+ if ( this . spaceApp . App ?. AppName ) {
114+ app = await this . client . describeApp ( {
115+ DomainId : this . spaceApp . DomainId ,
116+ AppName : this . spaceApp . App ?. AppName ,
117+ AppType : this . spaceApp ?. SpaceSettingsSummary ?. AppType ,
118+ SpaceName : this . spaceApp . SpaceName ,
119+ } )
120+ } else {
121+ const appsList = await this . client
122+ . listApps ( { DomainIdEquals : this . spaceApp . DomainId , SpaceNameEquals : this . spaceApp . SpaceName } )
123+ . flatten ( )
124+ . promise ( )
125+ app = appsList [ 0 ]
126+ }
116127
117128 // AWS DescribeSpace API returns full details with property names like 'SpaceSettings'
118129 // but our internal SagemakerSpaceApp type expects 'SpaceSettingsSummary' (from ListSpaces API)
0 commit comments