AWS Lambda CodePipeline无法对我的deps.json文件进行罚款?

时间:2019-09-13 18:42:50

标签: amazon-web-services aws-lambda amazon-cloudformation aws-codepipeline

我正在尝试构建和部署一个简单的示例项目来学习AWS。 C#/ .NET Core。

我的buildspec看起来像这样:

version: 0.2
phases:
  install:
    runtime-versions:
      dotnet: 2.2
  pre_build:
    commands:
      - echo Restore started on `date`
      - dotnet restore AWSServerless1.csproj
  build:
    commands:
      - echo Build started on `date`
      - dotnet publish -c release -o ./build_output AWSServerless1.csproj
artifacts:
  files:
    - ./build_output/**/*
    - scripts/**/*
    - appspec.yml
  discard-paths: yes

我的应用程序规格如下:

version: 0.0
Resources:
  - myStack-AspNetCoreFunction-1HPKUEU7I6GFW:
      Type: AWS::Lambda::Function
      Properties:
        Name: "myStack-AspNetCoreFunction-1HPKUEU7I6GFW"
        Alias: "AWSServerless1"
        CurrentVersion: "1"
        TargetVersion: "2"

管道成功完成,但是当我尝试运行lambda时,我得到了502。我检查了日志,并说:

Could not find the required 'AWSServerless1.deps.json'. This file should be present at the root of the deployment package.: LambdaException

当我从S3下载软件包时,一切似乎都已存在。这是一个zip文件,没有任何路径,所有内容都在zip的根目录中,包括AWSServerless1.deps.json。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

使用dotnet lambda软件包代替发布

请参阅https://github.com/aws/aws-extensions-for-dotnet-cli