@@ -108,12 +108,12 @@ class Apigw {
108108 } ;
109109 }
110110
111- marshalApiInput ( endpoint , apiInputs , serviceType ) {
111+ marshalApiInput ( endpoint , apiInputs ) {
112112 if ( endpoint . param ) {
113113 apiInputs . requestParameters = endpoint . param ;
114114 }
115115
116- apiInputs . serviceType = serviceType ;
116+ const { serviceType } = apiInputs ;
117117 endpoint . function = endpoint . function || { } ;
118118 // handle front-end API type of WEBSOCKET/HTTP
119119 if ( endpoint . protocol === 'WEBSOCKET' ) {
@@ -241,7 +241,10 @@ class Apigw {
241241 }
242242 }
243243 }
244- } else {
244+ }
245+
246+ // get API info after apiId confirmed
247+ if ( endpoint . apiId ) {
245248 apiDetail = await this . request ( {
246249 Action : 'DescribeApi' ,
247250 serviceId : serviceId ,
@@ -254,7 +257,7 @@ class Apigw {
254257 }
255258
256259 if ( ! exist ) {
257- this . marshalApiInput ( endpoint , apiInputs , apiInputs . serviceType ) ;
260+ this . marshalApiInput ( endpoint , apiInputs ) ;
258261 const { ApiId } = await this . request ( {
259262 Action : 'CreateApi' ,
260263 ...apiInputs ,
@@ -272,7 +275,7 @@ class Apigw {
272275 output . internalDomain = apiDetail . InternalDomain ;
273276 } else {
274277 console . log ( `Updating api with api id ${ endpoint . apiId } .` ) ;
275- this . marshalApiInput ( endpoint , apiInputs , apiDetail . ServiceType ) ;
278+ this . marshalApiInput ( endpoint , apiInputs ) ;
276279 await this . request ( {
277280 Action : 'ModifyApi' ,
278281 apiId : endpoint . apiId ,
0 commit comments