Skip to content

Commit f579abd

Browse files
committed
fix(scf): clear all environment variables
1 parent 3ead811 commit f579abd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/modules/scf/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,23 @@ class Scf {
163163
delete functionInputs.Handler;
164164
delete functionInputs.Code;
165165
delete functionInputs.CodeSource;
166+
// +++++++++++++++++++++++
167+
// Below are very strange logical for layer unbind, but backend api need me to do this.
166168
// handle unbind one layer
167-
// this is a very strange logical for layer unbind, but backend api need me to do this.
168169
if (functionInputs.Layers && functionInputs.Layers.length === 0) {
169170
functionInputs.Layers.push({
170171
LayerName: '',
171172
LayerVersion: 0,
172173
});
173174
}
175+
// handler empty environment variables
176+
if (
177+
!functionInputs.Environment ||
178+
!functionInputs.Environment.Variables ||
179+
functionInputs.Environment.Variables.length === 0
180+
) {
181+
functionInputs.Environment = { Variables: [{ Key: '', Value: '' }] };
182+
}
174183
await this.request(functionInputs);
175184
return true;
176185
}

0 commit comments

Comments
 (0)