aws / aws/aws-toolkit-azure-devops
LambdaNETCoreDeploy fails with nuget.config referencing Azure Devops artifacts
- Dominant language
- TypeScript
- Stars
- 258
- Forks
- 114
- PR merge metrics
- No merged PRs in 30d
Description
**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.
```
```
3. Create a c# dotnetcore3.0 lambda function
4. 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
Contributor guide
Research direction
Start at the LambdaNETCoreDeploy task setup step that runs `dotnet tool update -g Amazon.Lambda.Tools`, then reproduce the failure with a root nuget.config containing the private Azure DevOps feed. Done means the deployment completes without the unauthorized-feed error while preserving access to the configured package sources.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, azure, csharp, typescript
- Domain
- cloud, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100