diff --git a/serverless.component.yml b/serverless.component.yml index bea1688..64095f8 100644 --- a/serverless.component.yml +++ b/serverless.component.yml @@ -1,5 +1,5 @@ name: nextjs -version: 0.1.5 +version: 0.1.6 author: 'Tencent Cloud, Inc.' org: 'Tencent Cloud, Inc.' description: Deploy a serverless Next.js application onto Tencent SCF and API Gateway. diff --git a/src/utils.js b/src/utils.js index d104fe4..a45ed3c 100644 --- a/src/utils.js +++ b/src/utils.js @@ -299,7 +299,7 @@ const prepareInputs = async (instance, credentials, inputs = {}) => { // chenck state function name const stateFunctionName = instance.state[regionList[0]] && instance.state[regionList[0]].functionName - const functionConf = { + const functionConf = Object.assign(tempFunctionConf, { code: { src: inputs.src, bucket: inputs.srcOriginal && inputs.srcOriginal.bucket, @@ -339,14 +339,12 @@ const prepareInputs = async (instance, credentials, inputs = {}) => { publish: inputs.publish, traffic: inputs.traffic, lastVersion: instance.state.lastVersion, - eip: tempFunctionConf.eip === true, - l5Enable: tempFunctionConf.l5Enable === true, timeout: tempFunctionConf.timeout ? tempFunctionConf.timeout : CONFIGS.timeout, memorySize: tempFunctionConf.memorySize ? tempFunctionConf.memorySize : CONFIGS.memorySize, - tags: ensureObject(tempFunctionConf.tags ? tempFunctionConf.tags : inputs.tag, { + tags: ensureObject(tempFunctionConf.tags ? tempFunctionConf.tags : inputs.tags, { default: null }) - } + }) // validate traffic if (inputs.traffic !== undefined) { @@ -355,7 +353,7 @@ const prepareInputs = async (instance, credentials, inputs = {}) => { functionConf.needSetTraffic = inputs.traffic !== undefined && functionConf.lastVersion if (tempFunctionConf.environment) { - functionConf.environment = inputs.functionConf.environment + functionConf.environment = tempFunctionConf.environment functionConf.environment.variables = functionConf.environment.variables || {} functionConf.environment.variables.SERVERLESS = '1' functionConf.environment.variables.SLS_ENTRY_FILE = inputs.entryFile || CONFIGS.defaultEntryFile @@ -373,7 +371,7 @@ const prepareInputs = async (instance, credentials, inputs = {}) => { // 对apigw inputs进行标准化 const tempApigwConf = inputs.apigatewayConf ? inputs.apigatewayConf : {} - const apigatewayConf = { + const apigatewayConf = Object.assign(tempApigwConf, { serviceId: inputs.serviceId, region: regionList, isDisabled: tempApigwConf.isDisabled === true, @@ -396,7 +394,7 @@ const prepareInputs = async (instance, credentials, inputs = {}) => { } ], customDomains: tempApigwConf.customDomains || [] - } + }) if (tempApigwConf.usagePlan) { apigatewayConf.endpoints[0].usagePlan = { usagePlanId: tempApigwConf.usagePlan.usagePlanId,