Skip to content

Commit a76fe58

Browse files
committed
fix: update to deployment to serial flow
1 parent 968a965 commit a76fe58

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

serverless.component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: express
2-
version: 0.2.0
2+
version: 0.2.1
33
author: Tencent Cloud, Inc.
44
org: Tencent Cloud, Inc.
55
description: Deploy a serverless Express.js application on Tencent SCF and API Gateway.

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"dependencies": {
33
"download": "^8.0.0",
4-
"tencent-component-toolkit": "^1.17.0",
4+
"tencent-component-toolkit": "^1.19.8",
55
"type": "^2.0.0"
66
}
77
}

src/serverless.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,24 +196,33 @@ class ServerlessComponent extends Component {
196196
outputs.templateUrl = CONFIGS.templateUrl
197197
}
198198

199-
const deployTasks = [this.deployFunction(credentials, functionConf, regionList, outputs)]
199+
let apigwOutputs
200+
const functionOutputs = await this.deployFunction(
201+
credentials,
202+
functionConf,
203+
regionList,
204+
outputs
205+
)
200206
// support apigatewayConf.isDisabled
201207
if (apigatewayConf.isDisabled !== true) {
202-
deployTasks.push(this.deployApigateway(credentials, apigatewayConf, regionList, outputs))
208+
apigwOutputs = await this.deployApigateway(credentials, apigatewayConf, regionList, outputs)
203209
} else {
204210
this.state.apigwDisabled = true
205211
}
206-
const [functionOutputs, apigwOutputs = {}] = await Promise.all(deployTasks)
207212

208213
// optimize outputs for one region
209214
if (regionList.length === 1) {
210215
const [oneRegion] = regionList
211216
outputs.region = oneRegion
212-
outputs['apigw'] = apigwOutputs[oneRegion]
213217
outputs['scf'] = functionOutputs[oneRegion]
218+
if (apigwOutputs) {
219+
outputs['apigw'] = apigwOutputs[oneRegion]
220+
}
214221
} else {
215-
outputs['apigw'] = apigwOutputs
216222
outputs['scf'] = functionOutputs
223+
if (apigwOutputs) {
224+
outputs['apigw'] = apigwOutputs
225+
}
217226
}
218227

219228
this.state.region = regionList[0]

0 commit comments

Comments
 (0)