@@ -122,19 +122,24 @@ class ExtensionServiceImpl implements ExtensionServiceImplementation {
122
122
} ) ;
123
123
}
124
124
125
- const ownerToken = await this . sessionService . getAPI ( ) . getOwnerToken ( actualWorkspaceId , _context . signal ) ;
126
-
127
125
instanceId = rawWorkspace . status ! . instance ! . instanceId ;
128
126
129
- const workspaceUrl = new URL ( wsData . workspaceUrl ) ;
130
- const workspaceHost = workspaceUrl . host . substring ( workspaceUrl . host . indexOf ( '.' ) + 1 ) ;
131
- let actualWorkspaceUrl = wsData . workspaceUrl ;
132
- if ( workspaceId !== actualWorkspaceId ) {
133
- // Public api doesn't take into account "debug" workspaces, readd 'debug-' prefix
134
- actualWorkspaceUrl = actualWorkspaceUrl . replace ( actualWorkspaceId , workspaceId ) ;
135
- }
127
+ let ownerToken = '' ;
128
+ let workspaceHost = '' ;
129
+ let sshkey = '' ;
130
+ if ( wsData . phase === 'running' ) {
131
+ ownerToken = await this . sessionService . getAPI ( ) . getOwnerToken ( actualWorkspaceId , _context . signal ) ;
136
132
137
- const sshkey = wsData . phase === 'running' ? ( await this . getWorkspaceSSHKey ( ownerToken , actualWorkspaceUrl , _context . signal ) ) : '' ;
133
+ const workspaceUrl = new URL ( wsData . workspaceUrl ) ;
134
+ workspaceHost = workspaceUrl . host . substring ( workspaceUrl . host . indexOf ( '.' ) + 1 ) ;
135
+ let actualWorkspaceUrl = wsData . workspaceUrl ;
136
+ if ( workspaceId !== actualWorkspaceId ) {
137
+ // Public api doesn't take into account "debug" workspaces, readd 'debug-' prefix
138
+ actualWorkspaceUrl = actualWorkspaceUrl . replace ( actualWorkspaceId , workspaceId ) ;
139
+ }
140
+
141
+ sshkey = await this . getWorkspaceSSHKey ( ownerToken , actualWorkspaceUrl , _context . signal ) ;
142
+ }
138
143
139
144
return {
140
145
gitpodHost,
0 commit comments