lambda用github动作部署 - 部署成功,但管道失败

发布于 2025-01-18 16:04:07 字数 2062 浏览 3 评论 0原文

我正在尝试使用 GO 运行时部署 Lambda 函数。 AWS 控制台表明该函数在管道运行时确实已更新(上次修改日期在 Lambda 控制台中更新),但 Github Actions 指示失败(以下错误显示两次):

2022/04/04 00:08:30 ResourceConflictException: The operation cannot be performed at this time. An update is in progress for resource: arn:aws:lambda:us-east-2:***:function:get_all_products_go
{
  RespMetadata: {
    StatusCode: 409,
    RequestID: "cd2b5f3f-c245-4c55-9440-9bdc078bb2b9"
  },
  Message_: "The operation cannot be performed at this time. An update is in progress for resource: arn:aws:lambda:us-east-2:***:function:get_all_products_go",
  Type: "User"
}

这是我的管道配置 yaml 文件:

name: Deploy Lambda function

on:
  push:
    branches:
      - main

jobs:
  deploy-lambda:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v1

      - name: Install Go
        uses: actions/setup-go@v2
        with:
          go-version: '1.17.4'

      - name: Install dependencies
        run: |
          go version
          go mod init storefront-lambdas
          go mod tidy

      - name: Build binary
        run: |
          GOOS=linux GOARCH=amd64 go build get-all-products.go && zip deployment.zip get-all-products

      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: us-east-2

      - 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: us-east-2
          function_name: get_all_products_go
          zip_file: deployment.zip
          memory_size: 128
          timeout: 10
          handler: get-all-products
          role: arn:aws:iam::xxxxxxxxxx:role/lambda-basic-execution
          runtime: go1.x

I am trying to deploy a Lambda function with the GO runtime. The AWS console indicates that the function was indeed updated when the pipeline runs (the Last Modified date is updated in the Lambda console), but Github Actions indicates a failure (this following error is shown twice):

2022/04/04 00:08:30 ResourceConflictException: The operation cannot be performed at this time. An update is in progress for resource: arn:aws:lambda:us-east-2:***:function:get_all_products_go
{
  RespMetadata: {
    StatusCode: 409,
    RequestID: "cd2b5f3f-c245-4c55-9440-9bdc078bb2b9"
  },
  Message_: "The operation cannot be performed at this time. An update is in progress for resource: arn:aws:lambda:us-east-2:***:function:get_all_products_go",
  Type: "User"
}

Here is my pipeline configuration yaml file:

name: Deploy Lambda function

on:
  push:
    branches:
      - main

jobs:
  deploy-lambda:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v1

      - name: Install Go
        uses: actions/setup-go@v2
        with:
          go-version: '1.17.4'

      - name: Install dependencies
        run: |
          go version
          go mod init storefront-lambdas
          go mod tidy

      - name: Build binary
        run: |
          GOOS=linux GOARCH=amd64 go build get-all-products.go && zip deployment.zip get-all-products

      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: us-east-2

      - 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: us-east-2
          function_name: get_all_products_go
          zip_file: deployment.zip
          memory_size: 128
          timeout: 10
          handler: get-all-products
          role: arn:aws:iam::xxxxxxxxxx:role/lambda-basic-execution
          runtime: go1.x

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文