Random errors on lambda alias [INVALID_LAMBDA_CONFIGURATION]

0

Hi,

I have a codepipeline that handles the following stages to deploy an API GW and relative lambdas:

  1. CodeCommit
  2. CodeBuild
  3. CloudFormation

Deployment at a single Lambda Alias update fails, but the lambda function that has the alias is different each time, even if no change happens in the repository and in the deployed objects.

The single codedeploy failing alway reports the following error:

Deployment Failed
The deployment failed because the AppSpec file that specifies the AWS Lambda deployment configuration is missing or has an invalid configuration. The Lambda function alias version does not match the current version in AppSpec file. (Error code: INVALID_LAMBDA_CONFIGURATION)

Deployment configuration
CodeDeployDefault.LambdaAllAtOnce

If cloudformation stack is deleted and created anew deployment works.

mcm
asked 6 years ago1140 views
4 Answers
0

After a couple of good rounds with successful deployment, it chocked on "A conflicting deployment is in progress" reported in CloudFormation console always regarding Alias deployment.

CloudFormation is now trying to rollback, but it is taking a very long time to do so, while it deals with "Already chained. Call unchain() to get rid of the previous chaining." on unrelated Aliases.

N.B. Aliases are defined by SAM as following:

AWSTemplateFormatVersion: '2010-09-09'
Globals:
  Function:
    AutoPublishAlias:
      Ref: Stage
    DeploymentPreference:
      Type: AllAtOnce
    Environment:
      Variables:
        STAGE:
          Ref: Stage
mcm
answered 6 years ago
0

Now after the last failed update and UPDATE_ROLLBACK of CloudFormation changeset , CodeDeploy started failing with INVALID_LAMBDA_CONFIGURATION again on some random alias.

Is there anything that has to be done to avoid having to delete and recreate the whole stack?

mcm
answered 6 years ago
0

It definitely looks like there is some issue with the way the lambda function has been set up. Codedeploy will throw this particular error message when it receives validation errors from AWS Lambda, however it is difficult for Codedeploy to figure out the exact issue with the lambda function. Are you able to test your lambda function directly using Lambda cli?

answered 6 years ago
0

Hi deblinaataws,

First let me inform you that, since my last post, it has been working correctly for a month by now.
This stack (with a nested stack also) comprises more that 35 lambda functions and many other details related to api gateway endpoints, it did not fail on any specific lambda function in the stack but on a different one each time, at random. Those exact functions were unmodified from previous runs where they gave no issues.
Mind that this CD is done all automatically by a codepipeline in what I expect to be a predictable sequence.
Of course on Lambda CLI no error shown, the lambdas are very simple nodejs and python functions.

The good thing is that after a couple of days of repeated random errors the problems just vanished all the sudden and everything works fine now, without any apparent reason (including code modifications or SAM template changes).

Thanks
mcm

mcm
answered 6 years 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