Skip to content

Commit

Permalink
fix: config apigw id bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yugasun committed Apr 28, 2021
1 parent f296b08 commit 754c5fc
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion serverless.component.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: wordpress
version: 0.2.0
version: 0.2.1
author: Tencent Cloud, Inc.
org: Tencent Cloud, Inc.
description: Deploy a serverless wordpress.js application on Tencent SCF and API Gateway.
Expand Down
Binary file modified src/fixtures/faas/wp-init.zip
Binary file not shown.
1 change: 1 addition & 0 deletions src/fixtures/faas/wp-init/sl_handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ async function handler(event, context) {

const syncDBStatus = await syncDatabase()
if (!syncDBStatus) {
response.reason = '[Serverless DB Error]: Intialize failed.'
return response
}

Expand Down
2 changes: 1 addition & 1 deletion src/serverless.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ class ServerlessComponent extends Component {

// 8. 创建 API 网关
if (inputs.apigw) {
inputs.apigw.name = `${CONFIGS.apigw.name}-${uuid}`
inputs.apigw.name = `${CONFIGS.apigw.name}_${uuid}`
inputs.apigw.faas = {
name: wpServerOutput.name,
namespace: wpServerOutput.namespace
Expand Down
10 changes: 7 additions & 3 deletions src/utils/sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ async function invokeFaas({ instance, inputs, name, namespace, parameters }) {
try {
return JSON.parse(Result.RetMsg)
} catch (e) {
return {}
return {
status: false,
reason: e.message
}
}
}

Expand Down Expand Up @@ -171,12 +174,13 @@ async function deployApigw({ instance, inputs, state = {} }) {
}

const apigw = new Apigw(__TmpCredentials, region)

const serviceId = inputApigw.id || (state && state.id)
const sdkInput = Object.assign(inputApigw, {
isDisabled: inputApigw.isDisabled === true,
protocols: inputApigw.protocols || DEFAULT_CONFIGS.protocols,
environment: inputApigw.environment || DEFAULT_CONFIGS.environment,
serviceId: inputApigw.id || (state && state.id),
serviceId: serviceId,
isInputServiceId: !!serviceId,
serviceName: inputApigw.name || DEFAULT_CONFIGS.name,
serviceDesc: inputApigw.description || CONFIGS.description,
endpoints: [
Expand Down

0 comments on commit 754c5fc

Please sign in to comment.