Skip to content

Commit 3e9ce47

Browse files
committed
fix: params combination
1 parent 0951c95 commit 3e9ce47

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

dist/index.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -43705,28 +43705,30 @@ async function run() {
4370543705
if (IMAGE_URI) {
4370643706
updateParams["PackageType"] = "Image";
4370743707
updateParams["ImageUri"] = IMAGE_URI;
43708+
} else {
43709+
updateParamIfPresent("Runtime", RUNTIME);
43710+
updateParamIfPresent("Handler", HANDLER);
43711+
if (ENVIRONMENT) {
43712+
const Variables = JSON.parse(ENVIRONMENT);
43713+
updateParams["Environment"] = { Variables };
43714+
}
4370843715
}
4370943716

4371043717
// add optional params
43711-
updateParamIfPresent("Runtime", RUNTIME);
4371243718
updateParamIfPresent("Role", ROLE);
43713-
updateParamIfPresent("Handler", HANDLER);
4371443719
updateParamIfPresent("Description", DESCRIPTION);
4371543720
updateParamIfPresent("Timeout", convertOptionalToNumber(TIMEOUT));
4371643721
updateParamIfPresent("MemorySize", convertOptionalToNumber(MEMORY_SIZE));
4371743722
updateParamIfPresent(
4371843723
"Architectures",
4371943724
splitOptional(ARCHITECTURES) || ["x86_64"]
4372043725
);
43721-
if (ENVIRONMENT) {
43722-
const Variables = JSON.parse(ENVIRONMENT);
43723-
updateParams["Environment"] = { Variables };
43724-
}
4372543726

4372643727
// https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/lambda/command/UpdateFunctionCodeCommand/
43727-
const updateCommand = ZIP
43728-
? new UpdateFunctionCodeCommand(updateParams)
43729-
: new UpdateFunctionConfigurationCommand(updateParams);
43728+
const updateCommand =
43729+
ZIP || IMAGE_URI
43730+
? new UpdateFunctionCodeCommand(updateParams)
43731+
: new UpdateFunctionConfigurationCommand(updateParams);
4373043732
const lambdaClient = new LambdaClient(awsConfig);
4373143733
const response = await lambdaClient.send(updateCommand);
4373243734
console.log(response);

index.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -89,28 +89,30 @@ async function run() {
8989
if (IMAGE_URI) {
9090
updateParams["PackageType"] = "Image";
9191
updateParams["ImageUri"] = IMAGE_URI;
92+
} else {
93+
updateParamIfPresent("Runtime", RUNTIME);
94+
updateParamIfPresent("Handler", HANDLER);
95+
if (ENVIRONMENT) {
96+
const Variables = JSON.parse(ENVIRONMENT);
97+
updateParams["Environment"] = { Variables };
98+
}
9299
}
93100

94101
// add optional params
95-
updateParamIfPresent("Runtime", RUNTIME);
96102
updateParamIfPresent("Role", ROLE);
97-
updateParamIfPresent("Handler", HANDLER);
98103
updateParamIfPresent("Description", DESCRIPTION);
99104
updateParamIfPresent("Timeout", convertOptionalToNumber(TIMEOUT));
100105
updateParamIfPresent("MemorySize", convertOptionalToNumber(MEMORY_SIZE));
101106
updateParamIfPresent(
102107
"Architectures",
103108
splitOptional(ARCHITECTURES) || ["x86_64"]
104109
);
105-
if (ENVIRONMENT) {
106-
const Variables = JSON.parse(ENVIRONMENT);
107-
updateParams["Environment"] = { Variables };
108-
}
109110

110111
// https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/lambda/command/UpdateFunctionCodeCommand/
111-
const updateCommand = ZIP
112-
? new UpdateFunctionCodeCommand(updateParams)
113-
: new UpdateFunctionConfigurationCommand(updateParams);
112+
const updateCommand =
113+
ZIP || IMAGE_URI
114+
? new UpdateFunctionCodeCommand(updateParams)
115+
: new UpdateFunctionConfigurationCommand(updateParams);
114116
const lambdaClient = new LambdaClient(awsConfig);
115117
const response = await lambdaClient.send(updateCommand);
116118
console.log(response);

0 commit comments

Comments
 (0)