@@ -108,12 +108,12 @@ class Apigw {
108
108
} ;
109
109
}
110
110
111
- marshalApiInput ( endpoint , apiInputs , serviceType ) {
111
+ marshalApiInput ( endpoint , apiInputs ) {
112
112
if ( endpoint . param ) {
113
113
apiInputs . requestParameters = endpoint . param ;
114
114
}
115
115
116
- apiInputs . serviceType = serviceType ;
116
+ const { serviceType } = apiInputs ;
117
117
endpoint . function = endpoint . function || { } ;
118
118
// handle front-end API type of WEBSOCKET/HTTP
119
119
if ( endpoint . protocol === 'WEBSOCKET' ) {
@@ -241,7 +241,10 @@ class Apigw {
241
241
}
242
242
}
243
243
}
244
- } else {
244
+ }
245
+
246
+ // get API info after apiId confirmed
247
+ if ( endpoint . apiId ) {
245
248
apiDetail = await this . request ( {
246
249
Action : 'DescribeApi' ,
247
250
serviceId : serviceId ,
@@ -254,7 +257,7 @@ class Apigw {
254
257
}
255
258
256
259
if ( ! exist ) {
257
- this . marshalApiInput ( endpoint , apiInputs , apiInputs . serviceType ) ;
260
+ this . marshalApiInput ( endpoint , apiInputs ) ;
258
261
const { ApiId } = await this . request ( {
259
262
Action : 'CreateApi' ,
260
263
...apiInputs ,
@@ -272,7 +275,7 @@ class Apigw {
272
275
output . internalDomain = apiDetail . InternalDomain ;
273
276
} else {
274
277
console . log ( `Updating api with api id ${ endpoint . apiId } .` ) ;
275
- this . marshalApiInput ( endpoint , apiInputs , apiDetail . ServiceType ) ;
278
+ this . marshalApiInput ( endpoint , apiInputs ) ;
276
279
await this . request ( {
277
280
Action : 'ModifyApi' ,
278
281
apiId : endpoint . apiId ,
0 commit comments