aws / aws-toolkit-azure-devops

AWS Toolkit for Azure DevOps
Other
249 stars 106 forks source link

Cannot deploy .Net Core lambda/Serverless applications via Azure DevOps with Ubuntu Image #292

Open BrycePC opened 5 years ago

BrycePC commented 5 years ago

I believe this may be a duplicate of #259; which was closed but the issue still remains.

When attempting to install a .Net Core serverless application via Azure DevOps (hosted agent) the following error is returned:

[command]/usr/bin/dotnet tool install -g Amazon.Lambda.Tools Tool 'amazon.lambda.tools' is already installed. [command]/usr/bin/dotnet tool update -g Amazon.Lambda.Tools Tool 'amazon.lambda.tools' was reinstalled with the latest stable version (version '3.3.0'). [command]/usr/bin/dotnet restore Restore completed in 47.68 ms for /home/vsts/work/1/s/src/Organisation/Organisation.csproj. Beginning Serverless Deployment [command]/usr/bin/dotnet lambda deploy-serverless --stack-name IAOrganisation --region ap-southeast-2 --s3-bucket appdeploy-ap-southeast-2-802889573143-dev --s3-prefix iaorganisation --disable-interactive true **No executable found matching command "dotnet-lambda"

[error]Error: The process '/usr/bin/dotnet' failed with exit code 1

[section]Finishing: LambdaNETCoreDeploy**

Expected behavior The .Net Core application is deployed to AWS as a Lambda function

Screenshots

Your Environment

image

hunterwerlla commented 5 years ago

To confirm this is on a Linux build machine? What image did you select?

BrycePC commented 5 years ago

Hi, apologies for the slow response, The depoyments are working for me now. It was my first time using the newer Azure Pipelines for .Net Core with Yaml and a hosted agent - the yaml config had defaulted to use 'unbuntu-latest' for its pool/vmImage. It works after changing this to 'windows-latest'.

Thanks,

Bryce

hunterwerlla commented 5 years ago

Hm, that should work fine (and works on our test Azure Devops instance). I'll see if I can reproduce it with different settings and arked as a bug.

mantaroh commented 5 years ago

I've reproduced this phenomenon, then I used the following script as a workaround.


- script: dotnet tool install -g Amazon.Lambda.Tools
  displayName: Prepare the lambda environment

- script: |
    $(HOME)/.dotnet/tools/dotnet-lambda deploy-function --aws-access-key-id ${AWS_ACCESS_KEY} --aws-secret-key ${AWS_SECRET_KEY} --region ${LAMBDA_RESION} --fn ${LAMBDA_NAME} -fh ${LAMBDA_FUNC} --function-runtime ${LAMBDA_RUNTIME} --project-location ${PROJECT_LOCATION}
  displayName: Deploy Lambda
Mikilll94 commented 5 years ago

is it going to be fixed?

hunterwerlla commented 5 years ago

I have not been able to reproduce the issue, if someone has more details about the image they are using to build that would be helpful.

aguschirico commented 5 years ago

I'm getting the same issue when trying to build with Hosted ubuntu 16-04. It works fine in a win 2019 image.

plittlewood-rpt commented 5 years ago

I'm also having the same issue with Ubuntu

kolomiets commented 4 years ago

The same problem out there.

Works fine with win2019 - correct local path is used:

C:\Users\VssAdministrator\.dotnet\tools\dotnet-lambda.exe

Invalid global path is used on ubuntu image:

/usr/bin/dotnet lambda 
gpomykala commented 4 years ago

Same problem still in place almost a year after it was raised. dotnet lambda deploy-serverless cannot be found on 'ubuntu-latest' Azure-hosted agent. Works fine with 'windows-latest' however it ought to work on linux agents as well