Trying to update the AWS Lambda code with AWS Cloud Control API always fails.

0

When trying to update the lambda inline code I get the following error:

ValidationException: [REPLACE Operation] noSuchPath in source, path provided: //Code/ZipFile

If I try to update the S3ObjectVersion of the lambda code I get the following error:

ValidationException: [REPLACE Operation] noSuchPath in source, path provided: //Code/S3ObjectVersion

Why isn't it possible to update the lambda code like with AWS Cloud Formation?

Weirdly, when trying to change the Description of a lambda, it gives an error that the Code key is required.

ValidationException: Model validation failed (#: required key [Code] not found)

2 回答
0
已接受的回答

The reason was that Cloud Control API apparently has write-only properties. All write-only properties need to be included in every update. For some reason, I can't find any documentation about this. But you can find out what properties are write-only by fetching the resource after creation and diffing the properties that aren't present.

已回答 1 个月前
profile picture
专家
已审核 1 个月前
0

The errors indicate that Lambda is unable to find the code referenced in the function configuration.

  • The code may have been removed from the S3 location or code repository referenced in the function configuration. Lambda needs the code to be present at the specified location in order to update it.
  • The IAM role used by the function may not have the necessary permissions to access the code source. This could happen if the role policy was changed.
  • There may be a mismatch between the code location referenced in the function versus what is configured in the deployment package.

Try the following:

  • Check that the code is still present in S3 or the code repository
  • Verify the IAM role policy grants access to the code source
  • Use the Lambda console code editor to update the code directly instead of a separate deployment process
  • Delete and recreate the function if the code location cannot be corrected
  • When updating the description, Lambda still requires the Code property to be set even if not changing code. This is expected behavior.
profile picture
专家
已回答 2 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则