We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 827cd67 commit f090c79Copy full SHA for f090c79
__tests__/scf.test.ts
@@ -89,8 +89,7 @@ describe('Scf', () => {
89
const events = Object.entries(triggers).map(([, value]) => value);
90
91
const inputs: ScfDeployInputs = {
92
- // name: `serverless-test-${Date.now()}`,
93
- name: `serverless-test-fixed`,
+ name: `serverless-test-${Date.now()}`,
94
code: {
95
bucket: process.env.BUCKET,
96
object: 'express_code.zip',
@@ -573,6 +572,15 @@ describe('Scf', () => {
573
572
expect(outputs.AsyncRunEnable).toBe('TRUE');
574
expect(outputs.TraceEnable).toBe('TRUE');
575
});
+ test('[asyncRunEnable and traceEnable] update', async () => {
576
+ await sleep(3000);
577
+ inputs.asyncRunEnable = true;
578
+ inputs.traceEnable = false;
579
+ outputs = await scf.deploy(inputs);
580
+
581
+ expect(outputs.AsyncRunEnable).toBe('TRUE');
582
+ expect(outputs.TraceEnable).toBe('FALSE');
583
+ });
584
test('[asyncRunEnable and traceEnable] remove', async () => {
585
const res = await scf.remove({
586
functionName: inputs.name,
src/modules/scf/entities/scf.ts
@@ -167,7 +167,6 @@ export default class ScfEntity extends BaseEntity {
167
delete reqInputs.Code;
168
delete reqInputs.CodeSource;
169
delete reqInputs.AsyncRunEnable;
170
- delete reqInputs.TraceEnable;
171
172
// +++++++++++++++++++++++
173
// FIXME: 以下是函数绑定层逻辑,当函数有一个层,更新的时候想删除,需要传递参数 Layers 不能为空,必须包含特殊元素:{ LayerName: '', LayerVersion: 0 }
src/modules/scf/utils.ts
@@ -144,11 +144,9 @@ export const formatInputs = (region: RegionType, inputs: ScfCreateFunctionInputs
144
if (inputs.asyncRunEnable !== undefined) {
145
functionInputs.AsyncRunEnable = inputs.asyncRunEnable === true ? 'TRUE' : 'FALSE';
146
}
147
- // 只有配置 asyncRunEnable 为 true 时,才能配置 traceEnable 为 true
148
- if (inputs.traceEnable === true && functionInputs.AsyncRunEnable === 'TRUE') {
149
- functionInputs.TraceEnable = 'TRUE';
150
- } else {
151
- functionInputs.TraceEnable = 'FALSE';
+ if (inputs.traceEnable !== undefined) {
+ functionInputs.TraceEnable = inputs.traceEnable === true ? 'TRUE' : 'FALSE';
152
153
154
return functionInputs;
0 commit comments