@@ -133,10 +133,7 @@ export default class Apigw {
133133 } = inputs ;
134134
135135 // check service exist
136- const detail = await this . request ( {
137- Action : 'DescribeService' ,
138- ServiceId : serviceId ,
139- } ) ;
136+ const detail = await this . service . getById ( serviceId ) ;
140137 if ( ! detail ) {
141138 console . log ( `Service ${ serviceId } not exist` ) ;
142139 return ;
@@ -207,30 +204,36 @@ export default class Apigw {
207204 const endpoints = inputs . endpoints || [ ] ;
208205 const stateApiList = oldState . apiList || [ ] ;
209206
210- const serviceDetail = await this . service . getById ( serviceId ) ;
211-
212- const apiList : ApiEndpoint [ ] = await this . api . bulkDeploy ( {
213- apiList : endpoints ,
214- stateList : stateApiList ,
215- serviceId,
216- environment,
217- } ) ;
207+ const detail = await this . service . getById ( serviceId ) ;
208+ if ( detail ) {
209+ const apiList : ApiEndpoint [ ] = await this . api . bulkDeploy ( {
210+ apiList : endpoints ,
211+ stateList : stateApiList ,
212+ serviceId,
213+ environment,
214+ } ) ;
218215
219- await this . service . release ( { serviceId, environment } ) ;
216+ await this . service . release ( { serviceId, environment } ) ;
220217
221- console . log ( `Deploy service ${ serviceId } success` ) ;
218+ console . log ( `Deploy service ${ serviceId } success` ) ;
222219
223- const outputs : ApigwDeployOutputs = {
224- created : false ,
225- serviceId,
226- serviceName : serviceDetail . serviceName ,
227- subDomain : serviceDetail . subDomain ,
228- protocols : inputs . protocols ,
229- environment : environment ,
230- apiList,
231- } ;
220+ const subDomain =
221+ detail ! . OuterSubDomain && detail ! . InnerSubDomain
222+ ? [ detail ! . OuterSubDomain , detail ! . InnerSubDomain ]
223+ : detail ! . OuterSubDomain || detail ! . InnerSubDomain ;
232224
233- return outputs ;
225+ const outputs : ApigwDeployOutputs = {
226+ created : false ,
227+ serviceId,
228+ serviceName : detail . ServiceName ,
229+ subDomain : subDomain ,
230+ protocols : inputs . protocols ,
231+ environment : environment ,
232+ apiList,
233+ } ;
234+
235+ return outputs ;
236+ }
234237 }
235238}
236239
0 commit comments