Skip to content

Commit 850dafe

Browse files
committed
fix: update to deployment to serial flow
1 parent 1f984ba commit 850dafe

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: nuxtjs
2-
version: 0.1.6
2+
version: 0.1.7
33
author: 'Tencent Cloud, Inc.'
44
org: 'Tencent Cloud, Inc.'
55
description: Deploy a serverless Nuxt.js application onto Tencent SCF and API Gateway.

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"dependencies": {
33
"adm-zip": "^0.4.16",
44
"download": "^8.0.0",
5-
"tencent-component-toolkit": "^1.17.4",
5+
"tencent-component-toolkit": "^1.19.8",
66
"type": "^2.1.0"
77
}
88
}

src/serverless.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,24 +258,33 @@ class ServerlessComopnent extends Component {
258258
outputs.templateUrl = CONFIGS.templateUrl
259259
}
260260

261-
const deployTasks = [this.deployFunction(credentials, functionConf, regionList, outputs)]
261+
let apigwOutputs
262+
const functionOutputs = await this.deployFunction(
263+
credentials,
264+
functionConf,
265+
regionList,
266+
outputs
267+
)
262268
// support apigatewayConf.isDisabled
263269
if (apigatewayConf.isDisabled !== true) {
264-
deployTasks.push(this.deployApigateway(credentials, apigatewayConf, regionList, outputs))
270+
apigwOutputs = await this.deployApigateway(credentials, apigatewayConf, regionList, outputs)
265271
} else {
266272
this.state.apigwDisabled = true
267273
}
268-
const [functionOutputs, apigwOutputs = {}] = await Promise.all(deployTasks)
269274

270275
// optimize outputs for one region
271276
if (regionList.length === 1) {
272277
const [oneRegion] = regionList
273278
outputs.region = oneRegion
274-
outputs['apigw'] = apigwOutputs[oneRegion]
275279
outputs['scf'] = functionOutputs[oneRegion]
280+
if (apigwOutputs) {
281+
outputs['apigw'] = apigwOutputs[oneRegion]
282+
}
276283
} else {
277-
outputs['apigw'] = apigwOutputs
278284
outputs['scf'] = functionOutputs
285+
if (apigwOutputs) {
286+
outputs['apigw'] = apigwOutputs
287+
}
279288
}
280289

281290
// start deploy static cdn

0 commit comments

Comments
 (0)