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ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ