AWS Lambda 函数被删除。无法检索

AWS Lamda function got deleted. Not able to retrieve

我在 c# 中使用无服务器框架在 athena 中执行查询。 AWS Lamda 函数自动删除。当我尝试部署它时,它没有发生。

sls deploy --stage dev -- 部署函数 sls remove --stage dev -- 删除函数 当我尝试重新部署它时,出现如下错误:

正如他们在上面的屏幕截图中提到的,为了获得更多错误输出,我浏览了 link:它显示了堆栈详细信息。我附在下面

参考这张图片: [![在此处输入图片描述][2]][2]

serverless.yml

 # Welcome to Serverless!
#
# This file is the main config file for your service.
# It's very minimal at this point and uses default values.
# You can always add more config options for more control.
# We've included some commented out config examples here.
# Just uncomment any of them to get that config option.
#
# For full config options, check the docs:
#    docs.serverless.com
#
# Happy Coding!

service: management-athena

custom:
  defaultStage: dev
  currentStage: ${opt:stage, self:custom.defaultStage} # 'dev' is default unless overriden by --stage flag

provider:
  name: aws
  runtime: dotnetcore2.1
  stage: ${self:custom.currentStage}
  role: arn:aws:iam::***********:role/service-role/nexus_labmda_schema_partition  # must validly reference a role defined in your account
  timeout: 300
  environment: # Service wide environment variables
    DATABASE_NAME: ${file(./config/config.${self:custom.currentStage}.json):DATABASE_NAME}
    TABLE_NAME: ${file(./config/config.${self:custom.currentStage}.json):TABLE_NAME}
    S3_PATH: ${file(./config/config.${self:custom.currentStage}.json):S3_PATH}
    MAX_SITE_TO_BE_PROCESSED: ${file(./config/config.${self:custom.currentStage}.json):MAX_SITE_TO_BE_PROCESSED}

package:
  artifact: bin/release/netcoreapp2.1/deploy-package.zip

functions:
  delete_partition:
    handler: CsharpHandlers::AwsAthena.AthenaHandler::DeletePartition
    description: Lambda function which runs at specified interval to delete athena partitions
    # The `events` block defines how to trigger the AthenaHandler.DeletePartition code
    events:
      - schedule:
          rate: cron(0 8 * * ? *) #triggered every day at 3:00 AM EST.Provided time is in UTC. So 3 A.M EST is 8 A.M UTC
          enabled: true

我找到解决办法了! 有时我们会因为很多原因而无法部署 lamda 函数。正如@ASR 在评论中提到的,可能存在无服务器框架的版本问题。但就我而言,这并没有解决。只需尝试从云手表中删除您的功能的日志组。

转到 aws -> 展开服务 -> select CloudWatch -> select 日志 -> 搜索您的日志组 select 并将其删除。假设您的函数名称是 my_function 那么您的日志组名称将是这样的:aws/lamda/my_function 然后只需部署您的 lamda 函数。 我发布这个想法是为了帮助某人......!如有错误请指正