AWS Lamda函数已删除。无法检索

时间:2019-02-15 10:46:15

标签: aws-lambda serverless

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

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

enter image description here

正如他们在上面的屏幕截图中所提到的,有关更多错误输出,我浏览了链接:该链接显示了堆栈详细信息。我将其附在下面

请参考此图片: [![在此处输入图片描述] [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

1 个答案:

答案 0 :(得分:1)

我找到了解决方案!  有时由于多种原因,我们将无法部署lamda函数。正如@ASR在评论中提到的那样,可能存在无服务器框架的版本问题。但就我而言,这并没有解决。只需尝试从云监视中删除函数的日志组即可。

转到aws->展开服务->选择CloudWatch->选择Logs->搜索您的日志组,将其选中并删除。假设您的函数名称为 my_function ,则您的日志组名称将如下所示: aws / lamda / my_function 然后只需部署您的lamda函数。 我发布这样的想法是,它可以帮助某人...!如果我错了,请纠正我。