Skip to content

Commit 8451141

Browse files
committed
fix(scf): apigw function config bug
1 parent ed35c19 commit 8451141

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

src/baas/scf/index.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -268,20 +268,13 @@ class Scf {
268268
if (eventType === 'apigw') {
269269
const thisTrigger = inputs.events[i]['apigw']['parameters'];
270270
thisTrigger.region = this.region;
271-
const endpoints = [];
272-
thisTrigger.endpoints.forEach((endpoint) => {
273-
if (endpoint.function) {
274-
endpoint.function['functionName'] = funcInfo.FunctionName;
275-
} else {
276-
endpoint['function'] = {
277-
functionName: funcInfo.FunctionName,
278-
functionNamespace: funcInfo.Namespace,
279-
};
280-
}
281-
endpoints.push(endpoint);
282-
});
283271
thisTrigger.serviceName = thisTrigger.serviceName || inputs.events[i]['apigw']['name'];
284-
thisTrigger.endpoints = endpoints;
272+
thisTrigger.endpoints = thisTrigger.endpoints.map((endpoint) => {
273+
endpoint.function = endpoint.function || {};
274+
endpoint.function.functionName = funcInfo.FunctionName;
275+
endpoint.function.functionNamespace = funcInfo.Namespace;
276+
return endpoint;
277+
});
285278
try {
286279
deployThisTriggerResult = await this.apigwClient.deploy(thisTrigger);
287280
} catch (e) {

0 commit comments

Comments
 (0)