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 Answers
0
Accepted Answer

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.

answered a month ago
profile picture
EXPERT
reviewed 25 days ago
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
EXPERT
answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions