-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.net core - sam build command fails when private feeds in Nuget.Config #1970
Comments
I've created a Pull Request which should fix this issue |
Update, PR merged to develop |
Please refer to this issue I created: aws/aws-sam-cli#1970 Summary: when users have private feeds configured on their machines, the sam build command will fail because the dotnet cli tries to reference private feeds configured in the machine's global Nuget.Config Adding the --ignore-failed-sources flag (e.g. dotnet tool install "Amazaon.Lambda.Tools" -g --ignore-failed-sources) fixes the issue.
This issue has now been resolved. This is the commit to the master branch: aws/aws-lambda-builders@4493a84 You can get the fix if you download the latest version of SAM CLI |
Please refer to this issue I created: aws/aws-sam-cli#1970 Summary: when users have private feeds configured on their machines, the sam build command will fail because the dotnet cli tries to reference private feeds configured in the machine's global Nuget.Config Adding the --ignore-failed-sources flag (e.g. dotnet tool install "Amazaon.Lambda.Tools" -g --ignore-failed-sources) fixes the issue.
Hello , I have updated the latest version of SAM and trying to build .netcore lambda and getting the same exception. Can you please suggest what needs to be done . error NU3034: Package 'Amazon.Lambda.Tools 5.0.2' from source 'https://api.nuget.org/v3/index.json': This package is signed but not by a trusted signer. Build Failed
For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool |
Hi @nsivaji61 I wasn't able to replicate the issue. I have 2 private NUGET feeds configured in my machine and Environment Steps
Note: I only got a nuget warning, pretty much saying that my 2 private feeds couldn't be used during This looks like an unrelated issue. I suggest checking out this SO question. |
Description
Unable to use commands like
sam build
when working with .net core templates.The sam cli uses dotnet global tools(s).
E.g. from debug logs (i.e. when running sam build --debug):
executing dotnet: ['dotnet.exe', 'tool', 'install', '-g', 'Amazon.Lambda.Tools']
When executing these dotnet commands, the dotnet cli will perform a
dotnet restore
.dotnet restore
scans the user's machine global Nuget.Config file in order to get feed sources. *On Windows this config file is located in C:\Users<user>\AppData\Roaming\NuGetIf the Nuget.Config file contains private feed sources (e.g. Azure Artifacts) this will generate an Http 401 Unauthorized error, which in turn generates an unrecoverable exception.
As a result, when running the command
sam build
, we get an error which includes this messageTo solve this, Microsoft introduced the flag --ignore-failed-sources. E.g.
dotnet tool install "Amazon.Lambda.Tools" -g --ignore-failed-sources
This bug is pretty much a request to add this flag when the sam cli uses the dotnet cli under the hood for the sam build method (and any others applicable ones)
Steps to reproduce
Add a private feed. Easiest way to do is through Visual Studio (not vscode). Tools > Nuget Package Manager > Package Manager Settings > Package Sources > Add
Make sure you have the Sam cli installed. https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-windows.html
In command prompt or powershell, run the following command:
sam init
Choose option 1 (AWS Quick Start Templates)
Choose option 6 (dotnetcore3.1)
Press enter for default project name
step over to the sam-app directory. e.g.
cd sam-app
run the command
sam build --debug
Observed result
Expected result
As a workaround, if I uncomment any private feeds in the Nuget.Config file, then it works.
E.g.
Result
sam build
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
OS: Windows 10 1909
sam --version
: 0.48.0.net core sdk version installed on machine: 3.1.201
The text was updated successfully, but these errors were encountered: