函数创建失败,因为函数已存在 - 通过 serverless.yml Github Action 创建 Lambda 函数

问题描述 投票:0回答:1

如何覆盖/替换已存在的现有 Lambda 函数?

也许我必须将 serverless.yml 文件中的一些参数传递给 在使用相同名称创建时替换我现有的 lambda 函数!

出现错误

Error:
× Stack example-dev failed to deploy (66s)
CREATE_FAILED: exampleLambdaFunction (AWS::Lambda::Function)
Environment: linux, node 18.17.1, framework 3.36.0, plugin 7.1.0, SDK 4.4.0
Resource handler returned message: "Function creation failed because the function already exists" (RequestToken: f6a821ae-279c-3a1b-eac8-9d29f61ae3bf, HandlerErrorCode: AlreadyExists)
Credentials: Local, environment variables

我的 serverless.yml 文件

service: example

frameworkVersion: "3"

provider:
  name: aws
  runtime: nodejs14.x

# you can overwrite defaults here
  stage: dev
  region: ap-south-1

  versionFunctions: false

# you can define service wide environment variables here
  environment:
    TZ: Asia/Kolkata


functions:
  example:
    handler: index.handler
    name: example
    
aws-lambda github-actions serverless aws-sam
1个回答
0
投票

您可以使用 github 操作自动化 lambda 函数部署。 你可以看看这篇文章

© www.soinside.com 2019 - 2024. All rights reserved.