Skip to content

Commit aeb9873

Browse files
committed
fix(scf): throw error type
1 parent 0b2257b commit aeb9873

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/modules/scf/utils.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const CONFIGS = require('./config');
2+
const { TypeError } = require('../../utils/error');
23

34
/**
45
* Format apigw trigger inputs
@@ -14,11 +15,15 @@ const formatApigwTrigger = (region, funcInfo, inputs, traffic = false) => {
1415
triggerInputs.environment = parameters.environment;
1516
triggerInputs.serviceName = parameters.serviceName || name;
1617
triggerInputs.serviceId = parameters.serviceId;
17-
triggerInputs.endpoints = parameters.endpoints.map((ep) => {
18+
triggerInputs.endpoints = (parameters.endpoints || []).map((ep) => {
1819
ep.function = ep.function || {};
1920
ep.function.functionName = funcInfo.FunctionName;
2021
ep.function.functionNamespace = funcInfo.Namespace;
21-
ep.function.functionQualifier = traffic ? '$DEFAULT' : '$LATEST';
22+
ep.function.functionQualifier = ep.function.functionQualifier
23+
? ep.function.functionQualifier
24+
: traffic
25+
? '$DEFAULT'
26+
: '$LATEST';
2227
return ep;
2328
});
2429
return {

0 commit comments

Comments
 (0)