aws-toolkit-azure-devops icon indicating copy to clipboard operation
aws-toolkit-azure-devops copied to clipboard

LambdaNETCoreDeploy fails with nuget.config referencing Azure Devops artifacts

Open boro2g opened this issue 4 years ago • 6 comments

Describe the bug When you try to deploy to a lambda function, it performs an upgrade of Amazon.Lambda.Tools during the setup. We hit an issue where if you have a global nuget.config which references an azure devops package repo the command "C:\Program Files\dotnet\dotnet.exe" tool update -g Amazon.Lambda.Tools errors. To workaround we had to remove the common project nuget config

To reproduce

  1. setup new solution
  2. at root of sln add nuget.config with packageSource reference to a private nuget feed e.g.
<packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="AzureDevops" value="https://pkgs.dev.azure.com/###/_packaging/###/nuget/v3/index.json" />    
  </packageSources>
  1. Create a c# dotnetcore3.0 lambda function
  2. Setup a yaml pipeline with build task:
 - task: AmazonWebServices.aws-vsts-tools.LambdaNETCoreDeploy.LambdaNETCoreDeploy@1
      displayName: 'Deploy .NET Core to Lambda:  '
      inputs:
        awsCredentials: '###'
        regionName: 'eu-west-1'    
        lambdaProjectPath: '###'
        functionName: '###'
        functionRole: 'arn:aws:iam::###:role/###'
        functionHandler: 'not_required_for_custom_runtime'
        functionMemory: 256
        functionTimeout: 30

Expected behavior The deployment runs thorugh fine

Screenshots N/A. The error from the console is:

"C:\Program Files\dotnet\dotnet.exe" tool update -g Amazon.Lambda.Tools
C:\Program Files\dotnet\sdk\3.1.100\NuGet.targets(123,5): error : Unable to load the service index for source https://pkgs.dev.azure.com/###/_packaging/###/nuget/v3/index.json. [C:\Users\VssAdministrator\AppData\Local\Temp\hqfr4phi.yr2\restore.csproj]
C:\Program Files\dotnet\sdk\3.1.100\NuGet.targets(123,5): error :   Response status code does not indicate success: 401 (Unauthorized). [C:\Users\VssAdministrator\AppData\Local\Temp\hqfr4phi.yr2\restore.csproj]
Tool 'amazon.lambda.tools' failed to update due to the following:
The tool package could not be restored.
Tool 'amazon.lambda.tools' failed to install. This failure may have been caused by:

* You are attempting to install a preview release and did not use the --version option to specify the version.
* A package by this name was found, but it was not a .NET Core tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
* You mistyped the name of the tool.

For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool
##[error]Unable to install global Amazon.Lambda.Tools! The old package based version of Amazon.Lambda.Tools is now deprecated. Newer .NET core versions will need to use a newer hosted agent and the global tools (which this task auto installs). Refer to Microsoft's guide for the correct hosted agent for which hosted agent you need to use newer .NET Core versions:https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted
"C:\Program Files\dotnet\dotnet.exe" restore

Your Environment

  • Azure Devops latest version:

Additional context N/A

boro2g avatar Dec 20 '19 12:12 boro2g

Any progress on this please?

fabiomilheiro avatar Dec 28 '19 09:12 fabiomilheiro

It seems like nuget/the .netcore build tools do not have the right credentials:

 Response status code does not indicate success: 401 (Unauthorized).

How do you provide it with credentials to access your internal feed?

hunterwerlla avatar Jan 03 '20 15:01 hunterwerlla

Same issue here. If the repository is internal to your org you don't need to provide any credential.

santoror avatar Feb 19 '20 15:02 santoror

any update on this; I believe I'm also running into this same issue #336 I've included logs and have a step which deletes the nuget.config just prior the the lambda task; which allow the tools to insstall, but the execution fails as the command is unable to locate the tools?

3GDXC avatar Mar 31 '20 02:03 3GDXC

SAME PROBLEM

Jacko1394 avatar Apr 25 '20 08:04 Jacko1394

Same error here after commenting out all other nuget sources inside nuget.config, it still fails. At the very least, there needs to be a flag to disable update!

mithewt avatar Aug 28 '20 19:08 mithewt