Skip to content

Commit b7ac051

Browse files
authored
Fix Lambda update failure (#526)
#525 ``` The runtime parameter of nodejs8.10 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs12.x) while creating or updating functions. ``` Current Code: First, update the function code. At this time, the configuration is still outdated, so the runtime updates it with nodejs.8.10, which results in an error. Modifications: Update your settings at the beginning. This will update the runtime, so the update is expected to succeed. Since I can't create any nodejs8.10 functions already, I can't confirm their operation at hand.
1 parent 76aef49 commit b7ac051

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

lib/main.js

+24-18
Original file line numberDiff line numberDiff line change
@@ -544,31 +544,37 @@ so you can easily test run multiple events.
544544
FunctionName: params.FunctionName,
545545
Publish: params.Publish
546546
}, params.Code)
547+
547548
return new Promise((resolve, reject) => {
548-
const request = lambda.updateFunctionCode(_params, (err) => {
549+
const updateConfigRequest = lambda.updateFunctionConfiguration({
550+
FunctionName: params.FunctionName,
551+
Description: params.Description,
552+
Handler: params.Handler,
553+
MemorySize: params.MemorySize,
554+
Role: params.Role,
555+
Timeout: params.Timeout,
556+
Runtime: params.Runtime,
557+
VpcConfig: params.VpcConfig,
558+
Environment: params.Environment,
559+
KMSKeyArn: params.KMSKeyArn,
560+
DeadLetterConfig: params.DeadLetterConfig,
561+
TracingConfig: params.TracingConfig,
562+
Layers: params.Layers
563+
}, (err, configResponse) => {
549564
if (err) return reject(err)
550565

551-
lambda.updateFunctionConfiguration({
552-
FunctionName: params.FunctionName,
553-
Description: params.Description,
554-
Handler: params.Handler,
555-
MemorySize: params.MemorySize,
556-
Role: params.Role,
557-
Timeout: params.Timeout,
558-
Runtime: params.Runtime,
559-
VpcConfig: params.VpcConfig,
560-
Environment: params.Environment,
561-
KMSKeyArn: params.KMSKeyArn,
562-
DeadLetterConfig: params.DeadLetterConfig,
563-
TracingConfig: params.TracingConfig,
564-
Layers: params.Layers
565-
}, (err, data) => {
566+
const updateCodeReuest = lambda.updateFunctionCode(_params, (err) => {
566567
if (err) return reject(err)
567-
resolve(data)
568+
resolve(configResponse)
569+
})
570+
571+
updateCodeReuest.on('retry', (response) => {
572+
console.log(response.error.message)
573+
console.log('=> Retrying')
568574
})
569575
})
570576

571-
request.on('retry', (response) => {
577+
updateConfigRequest.on('retry', (response) => {
572578
console.log(response.error.message)
573579
console.log('=> Retrying')
574580
})

0 commit comments

Comments
 (0)