Validation Error when deploying lambda function through git actions

huangapple go评论44阅读模式
英文:

Validation Error when deploying lambda function through git actions

问题

这是我运行用于部署 Lambda 函数的 Git 动作:

name: 部署 TFM_dev 到 AWS Lambda
on:
  push:
    branches:
      - mybranch

jobs:
  deploy_source:
    name: 从源码部署 Lambda
    environment: DEV
    runs-on: ubuntu-latest
    steps:
      - name: 检出源代码
        uses: actions/checkout@v1
      - name: 压缩
        run: cd src && zip -r function.zip .
      - name: 默认部署
        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

然而,它一直返回以下错误:

ValidationException: 检测到 1 个验证错误:
值 '[]' 在 'layers' 处未能满足约束:
成员必须满足约束:
[成员长度必须小于或等于 140,
成员长度必须大于或等于 1,
成员必须满足正则表达式模式:(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-_]+),
成员不能为 null]

运行这些命令对我的其他 Lambda 函数有效,并且它们与层完全相同,所以我不明白为什么一直失败。

我已经测试了我的 Lambda 函数 - 它有效,我已更改了层版本(因为它们是自定义层),但它一直给我返回与上述相同的错误,我不确定如何设置 layers 的值,或者为什么我不需要为我的其他操作设置它。

英文:

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

答案1

得分: 0

"appleboy/lambda-action@master" 似乎有问题,因为切换到 "appleboy/lambda-action@v0.0.2" 解决了这个问题。

英文:

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

huangapple
  • 本文由 发表于 2023年3月31日 19:32:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/75898051.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定