Search code examples
amazon-web-servicesaws-lambdagithub-actionsaws-lambda-layers

Validation Error when deploying lambda function through git actions


This is the git action I run to deploy my lambda function:

name: Deploy TFM_dev to aws lambda
on:
  push:
    branches:
      - mybranch

jobs:
  deploy_source:
    name: deploy lambda from source
    environment: DEV
    runs-on: ubuntu-latest
    steps:
      - name: checkout source code
        uses: actions/checkout@v1
      - name: Zip
        run: cd src && zip -r function.zip .
      - name: default deploy
        uses: appleboy/lambda-action@master
        with:
          aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws_region: ${{ vars.AWS_REGION }}
          function_name: mylambda
          zip_file: src/function.zip

However, it keeps returning this error:

ValidationException: 1 validation error detected: 
Value '[]' at 'layers' failed to satisfy constraint: 
Member must satisfy constraint: 
[Member must have length less than or equal to 140, 
Member must have length greater than or equal to 1, 
Member must satisfy regular expression pattern: (arn:[a-zA-Z0-9-]+:lambda:[a-zA-Z0-9-]+:\d{12}:layer:[a-zA-Z0-9-_]+:[0-9]+)|(arn:[a-zA-Z0-9-]+:lambda:::awslayer:[a-zA-Z0-9-_]+), 
Member must not be null]

running these commands works for my other lambda function and it's the exact same layers so I'm confused why this keeps failing.

I tested my lambda function - which works, I've changed the layer version (as they are custom layers) but it keeps giving me the same error as above and I'm not sure how to even set the layers value or why I didn't need to set it for my other action


Solution

  • It appears the appleboy/lambda-action@master is to blame as switching to appleboy/lambda-action@v0.0.2 has solved the problem