in src/tasks/LambdaDeployFunction/TaskOperations.ts [57:84]
private async updateFunctionCode(): Promise<string> {
console.log(tl.loc('UpdatingFunctionCode', this.taskParameters.functionName))
try {
const updateCodeRequest: Lambda.UpdateFunctionCodeRequest = {
FunctionName: this.taskParameters.functionName,
Publish: this.taskParameters.publish
}
if (this.taskParameters.codeLocation === updateFromLocalFile) {
updateCodeRequest.ZipFile = readFileSync(this.taskParameters.localZipFile)
} else {
updateCodeRequest.S3Bucket = this.taskParameters.s3Bucket
updateCodeRequest.S3Key = this.taskParameters.s3ObjectKey
updateCodeRequest.S3ObjectVersion = this.taskParameters.s3ObjectVersion
}
const response = await this.lambdaClient.updateFunctionCode(updateCodeRequest).promise()
if (!response.FunctionArn) {
throw new Error(tl.loc('NoFunctionArnReturned'))
}
await this.waitForStatus(FUNCTION_UPDATED)
return response.FunctionArn
} catch (err) {
throw new Error(`Error while updating function code: ${err}`)
}
}