Skip to content
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

Bug: sam build and local invoke fail with NuGet error when using nuget.config with private feeds #6320

Open
jlrosenlof-kr opened this issue Nov 22, 2023 · 3 comments
Labels
area/build sam build command area/local/invoke sam local invoke command blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale.

Comments

@jlrosenlof-kr
Copy link

Description:

When I use sam build or sam local invoke to build or locally debug a lambda function in a solution with a nuget.config file, I get a NuGet error which comes from the build step where Amazon.Lambda.Tools is installed. This only happens with the sam cli commands. When I build and/or restore with dotnet, no error occurs. We have a number of libraries in a private Azure Artifacts feed which need to be used with our solution so not using a private NuGet feed is not an option. This error originally popped up while I was trying to upgrade a stack to use .NET 6 from .NET 3.1. The whole build and invoke process was working correctly previously but, after upgrading the .NET SDK and the SAM CLI, all of a sudden the sam cli commands started having errors. I am pretty sure that I have isolated this down to an issue with the sam cli.

This seems like it might be related to #1970 but I'm not sure.

I have tried using the same nuget.config file in another "non-sam" project and I am able to use and retrieve packages from the private Azure feed without any issues.

Here is the nuget.config file's contents:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <!--To inherit the global NuGet package sources remove the <clear/> line below -->
    <clear />
    <add key="nuget" value="https://api.nuget.org/v3/index.json" />
    <add key="PrivateAzureNuget" value="https://pkgs.dev.azure.com/myorg/<org-guid-here>/_packaging/MyProjectNuget/nuget/v3/index.json" />
  </packageSources>
</configuration>

Steps to reproduce:

  1. Create a brand new stack with sam init
  2. Build the stack with sam build. The stack builds without any problems.
  3. Add a custom nuget.config file. Make sure that the default NuGet feed at https://api.nuget.org/v3/index.json is included.
    • Do not add private feeds yet.
  4. Build the stack with sam build. The stack builds without any problems.
  5. Add a private NuGet feed to the nuget.config file below the default NuGet feed.
  6. Build the stack with sam build. The stack has an error.

In the example above, I am not even referencing any of the libraries from the private NuGet feed; just the presence of the private NuGet feed in the nuget.config file causes this issue to occur.

Observed result:

user@buildmachine:~/Dev/testSAMHelloWorld/NewTestDataProcStack/NewTestDataProcStack$ sam build --debug
2023-11-18 17:15:25,562 | Config file location: /home/user/Dev/testSAMHelloWorld/NewTestDataProcStack/NewTestDataProcStack/samconfig.toml                                           
2023-11-18 17:15:25,566 | Loading configuration values from [default.['build'].parameters] (env.command_name.section) in config file at                                                       
'/home/user/Dev/testSAMHelloWorld/NewTestDataProcStack/NewTestDataProcStack/samconfig.toml'...                                                                                      
2023-11-18 17:15:25,568 | Configuration values successfully loaded.                                                                                                                           
2023-11-18 17:15:25,569 | Configuration values are: {'stack_name': 'NewTestDataProcStack', 'cached': True, 'parallel': True}                                                                
2023-11-18 17:15:25,575 | Using SAM Template at /home/user/Dev/testSAMHelloWorld/NewTestDataProcStack/NewTestDataProcStack/template.yaml                                            
2023-11-18 17:15:25,608 | Using config file: samconfig.toml, config environment: default                                                                                                      
2023-11-18 17:15:25,618 | Expand command line arguments to:                                                                                                                                   
2023-11-18 17:15:25,619 | --template_file=/home/user/Dev/testSAMHelloWorld/NewTestDataProcStack/NewTestDataProcStack/template.yaml --parallel --mount_with=READ                     
--build_dir=.aws-sam/build --cache_dir=.aws-sam/cache --cached                                                                                                                                
2023-11-18 17:15:25,977 | 'build' command is called                                                                                                                                           
2023-11-18 17:15:25,979 | Starting Build use cache                                                                                                                                            
2023-11-18 17:15:25,982 | No Parameters detected in the template                                                                                                                              
2023-11-18 17:15:26,023 | There is no customer defined id or cdk path defined for resource helloFromLambdaFunction, so we will use the resource logical id as the resource id                 
2023-11-18 17:15:26,025 | 0 stacks found in the template                                                                                                                                      
2023-11-18 17:15:26,026 | No Parameters detected in the template                                                                                                                              
2023-11-18 17:15:26,047 | There is no customer defined id or cdk path defined for resource helloFromLambdaFunction, so we will use the resource logical id as the resource id                 
2023-11-18 17:15:26,053 | 1 resources found in the stack                                                                                                                                      
2023-11-18 17:15:26,055 | Found Serverless function with name='helloFromLambdaFunction' and CodeUri='./src/NewTestDataProcStack/'                                                           
2023-11-18 17:15:26,057 | --base-dir is not presented, adjusting uri ./src/NewTestDataProcStack/ relative to                                                                                
/home/user/Dev/testSAMHelloWorld/NewTestDataProcStack/NewTestDataProcStack/template.yaml                                                                                            
2023-11-18 17:15:26,062 | 1 resources found in the stack                                                                                                                                      
2023-11-18 17:15:26,064 | Found Serverless function with name='helloFromLambdaFunction' and CodeUri='./src/NewTestDataProcStack/'                                                           
2023-11-18 17:15:26,067 | Instantiating build definitions                                                                                                                                     
2023-11-18 17:15:26,082 | Same function build definition found, adding function (Previous: BuildDefinition(dotnet6,                                                                           
/home/user/Dev/testSAMHelloWorld/NewTestDataProcStack/NewTestDataProcStack/src/NewTestDataProcStack, Zip, , f51ff532-603c-4dae-801e-744661166ac2, {}, {}, x86_64, []), Current:   
BuildDefinition(dotnet6, /home/user/Dev/testSAMHelloWorld/NewTestDataProcStack/NewTestDataProcStack/src/NewTestDataProcStack, Zip, , ed2961a9-c098-44ca-a640-90a7ae823648, {}, {},
x86_64, []), Function: Function(function_id='helloFromLambdaFunction', name='helloFromLambdaFunction', functionname='helloFromLambdaFunction', runtime='dotnet6', memory=256, timeout=100,    
handler='NewTestDataProcStack::NewTestDataProcStack.Function::FunctionHandler', imageuri=None, packagetype='Zip', imageconfig=None,                                                       
codeuri='/home/user/Dev/testSAMHelloWorld/NewTestDataProcStack/NewTestDataProcStack/src/NewTestDataProcStack', environment=None, rolearn=None, layers=[], events=None,            
metadata={'SamResourceId': 'helloFromLambdaFunction'}, inlinecode=None, codesign_config_arn=None, architectures=['x86_64'], function_url_config=None,                                         
function_build_info=<FunctionBuildInfo.BuildableZip: ('BuildableZip', 'Regular ZIP function which can be build with SAM CLI')>, stack_path='', runtime_management_config=None,                
logging_config=None))                                                                                                                                                                         
2023-11-18 17:15:26,104 | Async execution started                                                                                                                                             
2023-11-18 17:15:26,106 | Invoking function functools.partial(<bound method ParallelBuildStrategy.build_single_function_definition of <samcli.lib.build.build_strategy.ParallelBuildStrategy  
object at 0x7fc958f26450>>, <samcli.lib.build.build_graph.FunctionBuildDefinition object at 0x7fc958f27850>)                                                                                  
2023-11-18 17:15:26,133 | Running incremental build for runtime dotnet6 for following resources (helloFromLambdaFunction)                                                                     
2023-11-18 17:15:26,134 | Waiting for async results                                                                                                                                           
2023-11-18 17:15:26,180 | Cache is invalid, running build and copying resources for following functions (helloFromLambdaFunction)                                                             
2023-11-18 17:15:26,182 | Building codeuri: /home/user/Dev/testSAMHelloWorld/NewTestDataProcStack/NewTestDataProcStack/src/NewTestDataProcStack runtime: dotnet6 metadata: {}     
architecture: x86_64 functions: helloFromLambdaFunction                                                                                                                                       
2023-11-18 17:15:26,193 | Building to following folder /home/user/Dev/testSAMHelloWorld/NewTestDataProcStack/NewTestDataProcStack/.aws-sam/build/helloFromLambdaFunction            
2023-11-18 17:15:26,195 | Loading workflow module 'aws_lambda_builders.workflows'                                                                                                             
2023-11-18 17:15:26,199 | Registering workflow 'CustomMakeBuilder' with capability 'Capability(language='provided', dependency_manager=None, application_framework=None)'                     
2023-11-18 17:15:26,211 | Registering workflow 'DotnetCliPackageBuilder' with capability 'Capability(language='dotnet', dependency_manager='cli-package', application_framework=None)'        
2023-11-18 17:15:26,217 | Registering workflow 'GoModulesBuilder' with capability 'Capability(language='go', dependency_manager='modules', application_framework=None)'                       
2023-11-18 17:15:26,245 | Registering workflow 'JavaGradleWorkflow' with capability 'Capability(language='java', dependency_manager='gradle', application_framework=None)'                    
2023-11-18 17:15:26,250 | Registering workflow 'JavaMavenWorkflow' with capability 'Capability(language='java', dependency_manager='maven', application_framework=None)'                      
2023-11-18 17:15:26,254 | Registering workflow 'NodejsNpmBuilder' with capability 'Capability(language='nodejs', dependency_manager='npm', application_framework=None)'                       
2023-11-18 17:15:26,271 | Registering workflow 'NodejsNpmEsbuildBuilder' with capability 'Capability(language='nodejs', dependency_manager='npm-esbuild', application_framework=None)'        
2023-11-18 17:15:26,275 | Registering workflow 'PythonPipBuilder' with capability 'Capability(language='python', dependency_manager='pip', application_framework=None)'                       
2023-11-18 17:15:26,289 | Registering workflow 'RubyBundlerBuilder' with capability 'Capability(language='ruby', dependency_manager='bundler', application_framework=None)'                   
2023-11-18 17:15:26,292 | Registering workflow 'RustCargoLambdaBuilder' with capability 'Capability(language='rust', dependency_manager='cargo', application_framework=None)'                 
2023-11-18 17:15:26,293 | Found workflow 'DotnetCliPackageBuilder' to support capabilities 'Capability(language='dotnet', dependency_manager='cli-package', application_framework=None)'      
2023-11-18 17:15:26,295 | Running workflow 'DotnetCliPackageBuilder'                                                                                                                          
2023-11-18 17:15:26,296 |  Running DotnetCliPackageBuilder:GlobalToolInstall                                                                                                                  
2023-11-18 17:15:26,297 | Entered synchronized block for updating Amazon.Lambda.Tools                                                                                                         
2023-11-18 17:15:26,298 | Installing Amazon.Lambda.Tools Global Tool                                                                                                                          
2023-11-18 17:15:26,299 | executing dotnet: ['dotnet', 'tool', 'install', '-g', 'Amazon.Lambda.Tools', '--ignore-failed-sources']                                                             
2023-11-18 17:15:26,796 |                                                                                                                                                                     
2023-11-18 17:15:26,798 | Error installing probably due to already installed. Attempt to update to latest version.                                                                            
2023-11-18 17:15:26,801 | executing dotnet: ['dotnet', 'tool', 'update', '-g', 'Amazon.Lambda.Tools', '--ignore-failed-sources']                                                              
2023-11-18 17:15:34,102 | Terminating plugin 'CredentialProvider.Microsoft' due to an unrecoverable fault:  NuGet.Protocol.Plugins.ProtocolException: A plugin protocol exception occurred.   
 ---> NuGet.Protocol.Plugins.ProtocolException: The SSL connection could not be established, see inner exception.                                                                             
   at NuGet.Protocol.Plugins.OutboundRequestContext`1.HandleFault(Message fault)                                                                                                              
   at NuGet.Protocol.Plugins.MessageDispatcher.OnMessageReceived(Object sender, MessageEventArgs e)                                                                                           
   at NuGet.Protocol.Plugins.Connection.OnMessageReceived(Object sender, MessageEventArgs e)                                                                                                  
   at NuGet.Protocol.Plugins.Receiver.FireMessageReceivedEvent(Message message)                                                                                                               
   at NuGet.Protocol.Plugins.StandardOutputReceiver.OnLineRead(Object sender, LineReadEventArgs e)                                                                                            
   --- End of inner exception stack trace ---                                                                                                                                                 
/usr/share/dotnet/sdk/6.0.417/NuGet.targets(132,5): error : A task was canceled. [/tmp/9bd7a666-2737-4d4f-8602-167f2d2b2f74/restore.csproj]                                                   
2023-11-18 17:15:34,110 | DotnetCliPackageBuilder:GlobalToolInstall failed                                                                                                                    
Traceback (most recent call last):                                                                                                                                                            
  File "aws_lambda_builders/workflows/dotnet_clipackage/actions.py", line 47, in execute                                                                                                      
  File "aws_lambda_builders/workflows/dotnet_clipackage/dotnetcli.py", line 65, in run                                                                                                        
aws_lambda_builders.workflows.dotnet_clipackage.dotnetcli.DotnetCLIExecutionError: Dotnet CLI Failed: Tool 'amazon.lambda.tools' is already installed.                                        
                                                                                                                                                                                              
During handling of the above exception, another exception occurred:                                                                                                                           
                                                                                                                                                                                              
Traceback (most recent call last):                                                                                                                                                            
  File "aws_lambda_builders/workflows/dotnet_clipackage/actions.py", line 52, in execute                                                                                                      
  File "aws_lambda_builders/workflows/dotnet_clipackage/dotnetcli.py", line 65, in run                                                                                                        
aws_lambda_builders.workflows.dotnet_clipackage.dotnetcli.DotnetCLIExecutionError: Dotnet CLI Failed: 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 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                                                                                          
                                                                                                                                                                                              
During handling of the above exception, another exception occurred:                                                                                                                           
                                                                                                                                                                                              
Traceback (most recent call last):                                                                                                                                                            
  File "aws_lambda_builders/workflow.py", line 371, in run                                                                                                                                    
  File "aws_lambda_builders/workflows/dotnet_clipackage/actions.py", line 57, in execute                                                                                                      
aws_lambda_builders.actions.ActionFailedError: Error configuring the Amazon.Lambda.Tools .NET Core Global Tool: Dotnet CLI Failed: 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 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                                                                                          
2023-11-18 17:15:34,138 | Exception raised during the execution                                                                                                                               

Build Failed
2023-11-18 17:15:34,141 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics                                                          
2023-11-18 17:15:34,304 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics                                                          
2023-11-18 17:15:34,304 | Sending Telemetry: {'metrics': [{'commandRun': {'requestId': 'b0c7f849-7f44-41f2-a85e-c91eacbb6b12', 'installationId': '11752e67-df08-4045-9099-f661e360e8ca',      
'sessionId': '29a794b7-2ae3-4502-8d01-97a8cb646a5a', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.11.3', 'samcliVersion': '1.103.0', 'awsProfileProvided': False,              
'debugFlagProvided': True, 'region': '', 'commandName': 'sam build', 'metricSpecificAttributes': {'projectType': 'CFN', 'gitOrigin': None, 'projectName':                                     
'3eecfc43b8f9ce0236269f327f5ad04f1e82ac73b713b7b13e41086e67a2867c', 'initialCommit': None}, 'duration': 8532, 'exitReason': 'WorkflowFailedError', 'exitCode': 1}}]}                          
2023-11-18 17:15:34,306 | Unable to find Click Context for getting session_id.                                                                                                                
2023-11-18 17:15:34,327 | Sending Telemetry: {'metrics': [{'events': {'requestId': 'c2822087-3ba6-49bc-babc-cedab6735ae4', 'installationId': '11752e67-df08-4045-9099-f661e360e8ca',          
'sessionId': '29a794b7-2ae3-4502-8d01-97a8cb646a5a', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.11.3', 'samcliVersion': '1.103.0', 'commandName': 'sam build',               
'metricSpecificAttributes': {'events': [{'event_name': 'SamConfigFileExtension', 'event_value': '.toml', 'thread_id': '7d8da1646eb749979a84f1d7746a0ccf', 'time_stamp': '2023-11-19           
01:15:25.562', 'exception_name': None}, {'event_name': 'SamConfigFileExtension', 'event_value': '.toml', 'thread_id': 'fbca4a96a2df4fe4b0469ed9f3b97bef', 'time_stamp': '2023-11-19           
01:15:25.608', 'exception_name': None}, {'event_name': 'BuildFunctionRuntime', 'event_value': 'dotnet6', 'thread_id': '5cfe9c58e8474b54a34abb2908a7751f', 'time_stamp': '2023-11-19           
01:15:26.067', 'exception_name': None}, {'event_name': 'BuildWorkflowUsed', 'event_value': 'dotnet-cli-package', 'thread_id': '3cdfda034a434b38a0c2c30588a69f7d', 'time_stamp': '2023-11-19   
01:15:26.194', 'exception_name': None}]}}}]}                                                                                                                                                  
2023-11-18 17:15:34,739 | Telemetry response: 200                                                                                                                                             
Error: DotnetCliPackageBuilder:GlobalToolInstall - Error configuring the Amazon.Lambda.Tools .NET Core Global Tool: Dotnet CLI Failed: 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 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
2023-11-18 17:15:34,743 | Telemetry response: 200 

Expected result:

To be able to use private feeds in a nuget.config file and have sam build and sam local invoke work.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: Linux Mint 20.3 (based on Ubuntu 20.04)
  2. sam --version: SAM CLI, version 1.103.0
  3. AWS region: us-west-1
{
  "version": "1.103.0",
  "system": {
    "python": "3.11.3",
    "os": "Linux-5.4.0-166-generic-x86_64-with-glibc2.31"
  },
  "additional_dependencies": {
    "docker_engine": "24.0.7",
    "aws_cdk": "Not available",
    "terraform": "Not available"
  },
  "available_beta_feature_env_vars": [
    "SAM_CLI_BETA_FEATURES",
    "SAM_CLI_BETA_BUILD_PERFORMANCE",
    "SAM_CLI_BETA_TERRAFORM_SUPPORT",
    "SAM_CLI_BETA_RUST_CARGO_LAMBDA"
  ]
}
@jlrosenlof-kr jlrosenlof-kr added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Nov 22, 2023
@jysheng123
Copy link
Contributor

Hi, thanks for bringing up the issue. I am having trouble replicating the error on my own machine, mainly due to not being able to create a private feed on azure. I was however able to create a github one that built fine. Is there an example project that you can provide for me to replicate the issue on? In the meanwhile, I have a couple ideas to try that may fix the issue. The first is running the sam build -u so it builds in a container. The second thing is to try deleting the Amazon.Lambda.Tools. From the official docs, they are located in $HOME/.dotnet/tools, can you run sam build after deleting the tools? Please let me know what the output you get with those ideas thanks.

@jysheng123 jysheng123 added the stage/needs-investigation Requires a deeper investigation label Nov 30, 2023
@jlrosenlof-kr
Copy link
Author

Hi Jay,

Thanks a ton for getting back to me and looking at this issue. I'm not sure what to do about the private feed other than adding an account of yours to our organization so that you can pull from the Azure Artifacts in our feed. I can provide an example project but, without being able to pull from the private Azure feed, I'm not sure how helpful that will be. Do you still want me to provide the sample project? I'll look into whether or not we could get you access to the private feed. In the meantime, though, I tried your other two suggestions.

Removing Amazon.Lambda.Tools

I read through the docs which you linked and I found that it was installed:

devuser@devbox:~$ dotnet tool list --global
Package Id               Version      Commands     
---------------------------------------------------
amazon.lambda.tools      5.9.0        dotnet-lambda

Then I removed the package with the following command:

devuser@devbox:~$ dotnet tool uninstall --global amazon.lambda.tools
Tool 'amazon.lambda.tools' (version '5.9.0') was successfully uninstalled.

After that, I re-ran the SAM build command. I didn't restart or log out or anything. I don't know if that's important or not. Here's the output from the command:

devuser@devbox:~/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack$ sam build --debug
2023-12-01 12:07:13,643 | Config file location: /home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/samconfig.toml                                           
2023-12-01 12:07:13,653 | Loading configuration values from [default.['build'].parameters] (env.command_name.section) in config file at                                                       
'/home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/samconfig.toml'...                                                                                      
2023-12-01 12:07:13,657 | Configuration values successfully loaded.                                                                                                                           
2023-12-01 12:07:13,659 | Configuration values are: {'stack_name': 'NewDevDataProcStack', 'cached': True, 'parallel': True}                                                                
2023-12-01 12:07:13,677 | Using SAM Template at /home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/template.yaml                                            
2023-12-01 12:07:13,832 | Using config file: samconfig.toml, config environment: default                                                                                                      
2023-12-01 12:07:13,849 | Expand command line arguments to:                                                                                                                                   
2023-12-01 12:07:13,851 | --template_file=/home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/template.yaml --parallel --mount_with=READ                     
--build_dir=.aws-sam/build --cache_dir=.aws-sam/cache --cached                                                                                                                                
2023-12-01 12:07:14,224 | 'build' command is called                                                                                                                                           
2023-12-01 12:07:14,227 | Starting Build use cache                                                                                                                                            
2023-12-01 12:07:14,231 | No Parameters detected in the template                                                                                                                              
2023-12-01 12:07:14,326 | There is no customer defined id or cdk path defined for resource helloFromLambdaFunction, so we will use the resource logical id as the resource id                 
2023-12-01 12:07:14,330 | 0 stacks found in the template                                                                                                                                      
2023-12-01 12:07:14,331 | No Parameters detected in the template                                                                                                                              
2023-12-01 12:07:14,388 | There is no customer defined id or cdk path defined for resource helloFromLambdaFunction, so we will use the resource logical id as the resource id                 
2023-12-01 12:07:14,390 | 1 resources found in the stack                                                                                                                                      
2023-12-01 12:07:14,391 | Found Serverless function with name='helloFromLambdaFunction' and CodeUri='./src/NewDevDataProcStack/'                                                           
2023-12-01 12:07:14,392 | --base-dir is not presented, adjusting uri ./src/NewDevDataProcStack/ relative to                                                                                
/home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/template.yaml                                                                                            
2023-12-01 12:07:14,447 | 1 resources found in the stack                                                                                                                                      
2023-12-01 12:07:14,448 | Found Serverless function with name='helloFromLambdaFunction' and CodeUri='./src/NewDevDataProcStack/'                                                           
2023-12-01 12:07:14,450 | Instantiating build definitions                                                                                                                                     
2023-12-01 12:07:14,481 | Same function build definition found, adding function (Previous: BuildDefinition(dotnet6,                                                                           
/home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/src/NewDevDataProcStack, Zip, 0865110871614c6c2a60f5798924b020e2a80814670f269748dca4ea032b873b,       
f51ff532-603c-4dae-801e-744661166ac2, {}, {}, x86_64, []), Current: BuildDefinition(dotnet6,                                                                                                  
/home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/src/NewDevDataProcStack, Zip, , f1516c7b-b867-4439-a2d7-1536c40b3072, {}, {}, x86_64, []), Function:  
Function(function_id='helloFromLambdaFunction', name='helloFromLambdaFunction', functionname='helloFromLambdaFunction', runtime='dotnet6', memory=256, timeout=100,                           
handler='NewDevDataProcStack::NewDevDataProcStack.Function::FunctionHandler', imageuri=None, packagetype='Zip', imageconfig=None,                                                       
codeuri='/home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/src/NewDevDataProcStack', environment=None, rolearn=None, layers=[], events=None,            
metadata={'SamResourceId': 'helloFromLambdaFunction'}, inlinecode=None, codesign_config_arn=None, architectures=['x86_64'], function_url_config=None,                                         
function_build_info=<FunctionBuildInfo.BuildableZip: ('BuildableZip', 'Regular ZIP function which can be build with SAM CLI')>, stack_path='', runtime_management_config=None,                
logging_config=None))                                                                                                                                                                         
2023-12-01 12:07:14,488 | Async execution started                                                                                                                                             
2023-12-01 12:07:14,489 | Invoking function functools.partial(<bound method ParallelBuildStrategy.build_single_function_definition of <samcli.lib.build.build_strategy.ParallelBuildStrategy  
object at 0x7ff4e1387f10>>, <samcli.lib.build.build_graph.FunctionBuildDefinition object at 0x7ff4e13b6510>)                                                                                  
2023-12-01 12:07:14,498 | Running incremental build for runtime dotnet6 for following resources (helloFromLambdaFunction)                                                                     
2023-12-01 12:07:14,500 | Waiting for async results                                                                                                                                           
2023-12-01 12:07:14,819 | Cache is invalid, running build and copying resources for following functions (helloFromLambdaFunction)                                                             
2023-12-01 12:07:14,821 | Building codeuri: /home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/src/NewDevDataProcStack runtime: dotnet6 metadata: {}     
architecture: x86_64 functions: helloFromLambdaFunction                                                                                                                                       
2023-12-01 12:07:14,822 | Building to following folder /home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/.aws-sam/build/helloFromLambdaFunction            
2023-12-01 12:07:14,825 | Loading workflow module 'aws_lambda_builders.workflows'                                                                                                             
2023-12-01 12:07:14,829 | Registering workflow 'CustomMakeBuilder' with capability 'Capability(language='provided', dependency_manager=None, application_framework=None)'                     
2023-12-01 12:07:14,833 | Registering workflow 'DotnetCliPackageBuilder' with capability 'Capability(language='dotnet', dependency_manager='cli-package', application_framework=None)'        
2023-12-01 12:07:14,839 | Registering workflow 'GoModulesBuilder' with capability 'Capability(language='go', dependency_manager='modules', application_framework=None)'                       
2023-12-01 12:07:14,843 | Registering workflow 'JavaGradleWorkflow' with capability 'Capability(language='java', dependency_manager='gradle', application_framework=None)'                    
2023-12-01 12:07:14,846 | Registering workflow 'JavaMavenWorkflow' with capability 'Capability(language='java', dependency_manager='maven', application_framework=None)'                      
2023-12-01 12:07:14,850 | Registering workflow 'NodejsNpmBuilder' with capability 'Capability(language='nodejs', dependency_manager='npm', application_framework=None)'                       
2023-12-01 12:07:14,854 | Registering workflow 'NodejsNpmEsbuildBuilder' with capability 'Capability(language='nodejs', dependency_manager='npm-esbuild', application_framework=None)'        
2023-12-01 12:07:14,904 | Registering workflow 'PythonPipBuilder' with capability 'Capability(language='python', dependency_manager='pip', application_framework=None)'                       
2023-12-01 12:07:14,907 | Registering workflow 'RubyBundlerBuilder' with capability 'Capability(language='ruby', dependency_manager='bundler', application_framework=None)'                   
2023-12-01 12:07:14,911 | Registering workflow 'RustCargoLambdaBuilder' with capability 'Capability(language='rust', dependency_manager='cargo', application_framework=None)'                 
2023-12-01 12:07:14,927 | Found workflow 'DotnetCliPackageBuilder' to support capabilities 'Capability(language='dotnet', dependency_manager='cli-package', application_framework=None)'      
2023-12-01 12:07:15,171 | Running workflow 'DotnetCliPackageBuilder'                                                                                                                          
2023-12-01 12:07:15,173 |  Running DotnetCliPackageBuilder:GlobalToolInstall                                                                                                                  
2023-12-01 12:07:15,174 | Entered synchronized block for updating Amazon.Lambda.Tools                                                                                                         
2023-12-01 12:07:15,175 | Installing Amazon.Lambda.Tools Global Tool                                                                                                                          
2023-12-01 12:07:15,176 | executing dotnet: ['dotnet', 'tool', 'install', '-g', 'Amazon.Lambda.Tools', '--ignore-failed-sources']                                                             
2023-12-01 12:07:25,953 | Terminating plugin 'CredentialProvider.Microsoft' due to an unrecoverable fault:  NuGet.Protocol.Plugins.ProtocolException: A plugin protocol exception occurred.   
 ---> NuGet.Protocol.Plugins.ProtocolException: The SSL connection could not be established, see inner exception.                                                                             
   at NuGet.Protocol.Plugins.OutboundRequestContext`1.HandleFault(Message fault)                                                                                                              
   at NuGet.Protocol.Plugins.MessageDispatcher.OnMessageReceived(Object sender, MessageEventArgs e)                                                                                           
   at NuGet.Protocol.Plugins.Connection.OnMessageReceived(Object sender, MessageEventArgs e)                                                                                                  
   at NuGet.Protocol.Plugins.Receiver.FireMessageReceivedEvent(Message message)                                                                                                               
   at NuGet.Protocol.Plugins.StandardOutputReceiver.OnLineRead(Object sender, LineReadEventArgs e)                                                                                            
   --- End of inner exception stack trace ---                                                                                                                                                 
/usr/share/dotnet/sdk/6.0.417/NuGet.targets(132,5): error : A task was canceled. [/tmp/904ac212-1aea-415c-945f-908967a0b96f/restore.csproj]                                                   
2023-12-01 12:07:25,957 | Error installing probably due to already installed. Attempt to update to latest version.                                                                            
2023-12-01 12:07:25,958 | executing dotnet: ['dotnet', 'tool', 'update', '-g', 'Amazon.Lambda.Tools', '--ignore-failed-sources']                                                              
2023-12-01 12:07:29,244 | Terminating plugin 'CredentialProvider.Microsoft' due to an unrecoverable fault:  NuGet.Protocol.Plugins.ProtocolException: A plugin protocol exception occurred.   
 ---> NuGet.Protocol.Plugins.ProtocolException: The SSL connection could not be established, see inner exception.                                                                             
   at NuGet.Protocol.Plugins.OutboundRequestContext`1.HandleFault(Message fault)                                                                                                              
   at NuGet.Protocol.Plugins.MessageDispatcher.OnMessageReceived(Object sender, MessageEventArgs e)                                                                                           
   at NuGet.Protocol.Plugins.Connection.OnMessageReceived(Object sender, MessageEventArgs e)                                                                                                  
   at NuGet.Protocol.Plugins.Receiver.FireMessageReceivedEvent(Message message)                                                                                                               
   at NuGet.Protocol.Plugins.StandardOutputReceiver.OnLineRead(Object sender, LineReadEventArgs e)                                                                                            
   --- End of inner exception stack trace ---                                                                                                                                                 
/usr/share/dotnet/sdk/6.0.417/NuGet.targets(132,5): error : A task was canceled. [/tmp/48793899-9407-4e93-b977-596fbfa07843/restore.csproj]                                                   
2023-12-01 12:07:29,248 | DotnetCliPackageBuilder:GlobalToolInstall failed                                                                                                                    
Traceback (most recent call last):                                                                                                                                                            
  File "aws_lambda_builders/workflows/dotnet_clipackage/actions.py", line 47, in execute                                                                                                      
  File "aws_lambda_builders/workflows/dotnet_clipackage/dotnetcli.py", line 65, in run                                                                                                        
aws_lambda_builders.workflows.dotnet_clipackage.dotnetcli.DotnetCLIExecutionError: Dotnet CLI Failed: 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 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                                                                                          
                                                                                                                                                                                              
During handling of the above exception, another exception occurred:                                                                                                                           
                                                                                                                                                                                              
Traceback (most recent call last):                                                                                                                                                            
  File "aws_lambda_builders/workflows/dotnet_clipackage/actions.py", line 52, in execute                                                                                                      
  File "aws_lambda_builders/workflows/dotnet_clipackage/dotnetcli.py", line 65, in run                                                                                                        
aws_lambda_builders.workflows.dotnet_clipackage.dotnetcli.DotnetCLIExecutionError: Dotnet CLI Failed: 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 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                                                                                          
                                                                                                                                                                                              
During handling of the above exception, another exception occurred:                                                                                                                           
                                                                                                                                                                                              
Traceback (most recent call last):                                                                                                                                                            
  File "aws_lambda_builders/workflow.py", line 371, in run                                                                                                                                    
  File "aws_lambda_builders/workflows/dotnet_clipackage/actions.py", line 57, in execute                                                                                                      
aws_lambda_builders.actions.ActionFailedError: Error configuring the Amazon.Lambda.Tools .NET Core Global Tool: Dotnet CLI Failed: 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 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                                                                                          
2023-12-01 12:07:29,287 | Exception raised during the execution                                                                                                                               

Build Failed
2023-12-01 12:07:29,297 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics                                                          
2023-12-01 12:07:29,330 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics                                                          
2023-12-01 12:07:29,330 | Sending Telemetry: {'metrics': [{'commandRun': {'requestId': 'ae2cea93-06b7-4ebf-9d70-09ef8e3af282', 'installationId': '11752e67-df08-4045-9099-f661e360e8ca',      
'sessionId': '06720bbc-1938-4326-a896-ae45379fdb44', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.11.3', 'samcliVersion': '1.103.0', 'awsProfileProvided': False,              
'debugFlagProvided': True, 'region': '', 'commandName': 'sam build', 'metricSpecificAttributes': {'projectType': 'CFN', 'gitOrigin': None, 'projectName':                                     
'3eecfc43b8f9ce0236269f327f5ad04f1e82ac73b713b7b13e41086e67a2867c', 'initialCommit': None}, 'duration': 15477, 'exitReason': 'WorkflowFailedError', 'exitCode': 1}}]}                         
2023-12-01 12:07:29,331 | Unable to find Click Context for getting session_id.                                                                                                                
2023-12-01 12:07:29,336 | Sending Telemetry: {'metrics': [{'events': {'requestId': 'beefd7da-389a-47cf-9614-5493ff170765', 'installationId': '11752e67-df08-4045-9099-f661e360e8ca',          
'sessionId': '06720bbc-1938-4326-a896-ae45379fdb44', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.11.3', 'samcliVersion': '1.103.0', 'commandName': 'sam build',               
'metricSpecificAttributes': {'events': [{'event_name': 'SamConfigFileExtension', 'event_value': '.toml', 'thread_id': '99bfedb98d604d308cc100b043ac366d', 'time_stamp': '2023-12-01           
20:07:13.642', 'exception_name': None}, {'event_name': 'SamConfigFileExtension', 'event_value': '.toml', 'thread_id': '49dc5c6bdde94d359797d02f57a7d89c', 'time_stamp': '2023-12-01           
20:07:13.813', 'exception_name': None}, {'event_name': 'BuildFunctionRuntime', 'event_value': 'dotnet6', 'thread_id': '4cda582500ba4bb18ad449c6716ed61f', 'time_stamp': '2023-12-01           
20:07:14.450', 'exception_name': None}, {'event_name': 'BuildWorkflowUsed', 'event_value': 'dotnet-cli-package', 'thread_id': '87b7e32cc02f4201a53b00b4db0b661e', 'time_stamp': '2023-12-01   
20:07:14.824', 'exception_name': None}]}}}]}                                                                                                                                                  
2023-12-01 12:07:29,842 | Telemetry response: 200                                                                                                                                             
Error: DotnetCliPackageBuilder:GlobalToolInstall - Error configuring the Amazon.Lambda.Tools .NET Core Global Tool: Dotnet CLI Failed: 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 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
2023-12-01 12:07:29,855 | Telemetry response: 200

It looks like it's still got the same error. There's some problem that it has with that private Azure Nuget feed. Like I mentioned earlier, that Nuget feed was working for a long time with the SAM tool. I was able to build and debug with the local invoke command and then, all of sudden, I was getting the error above.

BTW, dotnet restore and dotnet build on the same project works without any issues.

Building in a container

Building in a container was an interesting idea that I hadn't thought of. I gave that a try and it seemed to work, but then I got a pop up from the C# extension for VS Code after the build saying that it had failed and it provided some error logs. I'm going to paste my build command and its logs below and then, after that, I'll post the error message that was shown by the C# extension.

devuser@devbox:~/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack$ sam build --debug -u
2023-12-01 12:37:24,361 | Config file location: /home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/samconfig.toml                                           
2023-12-01 12:37:24,365 | Loading configuration values from [default.['build'].parameters] (env.command_name.section) in config file at                                                       
'/home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/samconfig.toml'...                                                                                      
2023-12-01 12:37:24,367 | Configuration values successfully loaded.                                                                                                                           
2023-12-01 12:37:24,368 | Configuration values are: {'stack_name': 'NewDevDataProcStack', 'cached': True, 'parallel': True}                                                                
2023-12-01 12:37:24,373 | Using SAM Template at /home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/template.yaml                                            
2023-12-01 12:37:24,406 | Using config file: samconfig.toml, config environment: default                                                                                                      
2023-12-01 12:37:24,407 | Expand command line arguments to:                                                                                                                                   
2023-12-01 12:37:24,409 | --template_file=/home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/template.yaml --use_container --parallel --mount_with=READ     
--build_dir=.aws-sam/build --cache_dir=.aws-sam/cache --cached                                                                                                                                
2023-12-01 12:37:24,705 | 'build' command is called                                                                                                                                           
2023-12-01 12:37:24,706 | Starting Build use cache                                                                                                                                            
2023-12-01 12:37:24,707 | Starting Build inside a container                                                                                                                                   
2023-12-01 12:37:24,735 | No Parameters detected in the template                                                                                                                              
2023-12-01 12:37:24,814 | There is no customer defined id or cdk path defined for resource helloFromLambdaFunction, so we will use the resource logical id as the resource id                 
2023-12-01 12:37:24,817 | 0 stacks found in the template                                                                                                                                      
2023-12-01 12:37:24,820 | No Parameters detected in the template                                                                                                                              
2023-12-01 12:37:24,846 | There is no customer defined id or cdk path defined for resource helloFromLambdaFunction, so we will use the resource logical id as the resource id                 
2023-12-01 12:37:24,848 | 1 resources found in the stack                                                                                                                                      
2023-12-01 12:37:24,849 | Found Serverless function with name='helloFromLambdaFunction' and CodeUri='./src/NewDevDataProcStack/'                                                           
2023-12-01 12:37:24,850 | --base-dir is not presented, adjusting uri ./src/NewDevDataProcStack/ relative to                                                                                
/home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/template.yaml                                                                                            
2023-12-01 12:37:24,855 | 1 resources found in the stack                                                                                                                                      
2023-12-01 12:37:24,857 | Found Serverless function with name='helloFromLambdaFunction' and CodeUri='./src/NewDevDataProcStack/'                                                           

Building functions with dotnet inside containers needs mounting with write permissions to the source code directory /home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/src/NewDevDataProcStack. Some files in this directory may be changed or added by the build process. Pass `--mount-with WRITE` to `sam build` CLI to avoid this confirmation. 
Would you like to enable mounting with write permissions?  [y/N]: y
2023-12-01 12:37:56,620 | Instantiating build definitions                                                                                                                                     
2023-12-01 12:37:56,641 | Same function build definition found, adding function (Previous: BuildDefinition(dotnet6,                                                                           
/home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/src/NewDevDataProcStack, Zip, 0865110871614c6c2a60f5798924b020e2a80814670f269748dca4ea032b873b,       
f51ff532-603c-4dae-801e-744661166ac2, {}, {}, x86_64, []), Current: BuildDefinition(dotnet6,                                                                                                  
/home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/src/NewDevDataProcStack, Zip, , 7abbcc26-d177-4676-9cca-32e719e35114, {}, {}, x86_64, []), Function:  
Function(function_id='helloFromLambdaFunction', name='helloFromLambdaFunction', functionname='helloFromLambdaFunction', runtime='dotnet6', memory=256, timeout=100,                           
handler='NewDevDataProcStack::NewDevDataProcStack.Function::FunctionHandler', imageuri=None, packagetype='Zip', imageconfig=None,                                                       
codeuri='/home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/src/NewDevDataProcStack', environment=None, rolearn=None, layers=[], events=None,            
metadata={'SamResourceId': 'helloFromLambdaFunction'}, inlinecode=None, codesign_config_arn=None, architectures=['x86_64'], function_url_config=None,                                         
function_build_info=<FunctionBuildInfo.BuildableZip: ('BuildableZip', 'Regular ZIP function which can be build with SAM CLI')>, stack_path='', runtime_management_config=None,                
logging_config=None))                                                                                                                                                                         
2023-12-01 12:37:56,658 | Async execution started                                                                                                                                             
2023-12-01 12:37:56,663 | Invoking function functools.partial(<bound method ParallelBuildStrategy.build_single_function_definition of <samcli.lib.build.build_strategy.ParallelBuildStrategy  
object at 0x7fa37c0f2950>>, <samcli.lib.build.build_graph.FunctionBuildDefinition object at 0x7fa37c2e2f90>)                                                                                  
2023-12-01 12:37:56,669 | Running incremental build for runtime dotnet6 for following resources (helloFromLambdaFunction)                                                                     
2023-12-01 12:37:56,670 | Waiting for async results                                                                                                                                           
2023-12-01 12:37:56,682 | Cache is invalid, running build and copying resources for following functions (helloFromLambdaFunction)                                                             
2023-12-01 12:37:56,685 | Building codeuri: /home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/src/NewDevDataProcStack runtime: dotnet6 metadata: {}     
architecture: x86_64 functions: helloFromLambdaFunction                                                                                                                                       
2023-12-01 12:37:56,687 | Building to following folder /home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/.aws-sam/build/helloFromLambdaFunction            

Fetching public.ecr.aws/sam/build-dotnet6:latest-x86_64 Docker container image................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
2023-12-01 12:43:53,727 | Mounting /home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/src/NewDevDataProcStack as /tmp/samcli/source:rw,delegated, inside 
runtime container                                                                                                                                                                             
2023-12-01 12:43:53,731 | Detect non-root user, will pass argument '--user 1000:4' to container                                                                                               
2023-12-01 12:44:06,628 | Successfully created temporary directory                                                                                                                            
/home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/.aws-sam/build/tmp-6fe422ec32e44c29ad77d440805c4a5a on the host.                                         
Using the request object from command line argument
Loading workflow module 'aws_lambda_builders.workflows'
Registering workflow 'CustomMakeBuilder' with capability 'Capability(language='provided', dependency_manager=None, application_framework=None)'
Registering workflow 'DotnetCliPackageBuilder' with capability 'Capability(language='dotnet', dependency_manager='cli-package', application_framework=None)'
Registering workflow 'GoModulesBuilder' with capability 'Capability(language='go', dependency_manager='modules', application_framework=None)'
Registering workflow 'JavaGradleWorkflow' with capability 'Capability(language='java', dependency_manager='gradle', application_framework=None)'
Registering workflow 'JavaMavenWorkflow' with capability 'Capability(language='java', dependency_manager='maven', application_framework=None)'
Registering workflow 'NodejsNpmBuilder' with capability 'Capability(language='nodejs', dependency_manager='npm', application_framework=None)'
Registering workflow 'NodejsNpmEsbuildBuilder' with capability 'Capability(language='nodejs', dependency_manager='npm-esbuild', application_framework=None)'
Registering workflow 'PythonPipBuilder' with capability 'Capability(language='python', dependency_manager='pip', application_framework=None)'
Registering workflow 'RubyBundlerBuilder' with capability 'Capability(language='ruby', dependency_manager='bundler', application_framework=None)'
Registering workflow 'RustCargoLambdaBuilder' with capability 'Capability(language='rust', dependency_manager='cargo', application_framework=None)'
Found workflow 'DotnetCliPackageBuilder' to support capabilities 'Capability(language='dotnet', dependency_manager='cli-package', application_framework=None)'
Running workflow 'DotnetCliPackageBuilder'
 Running DotnetCliPackageBuilder:GlobalToolInstall
Entered synchronized block for updating Amazon.Lambda.Tools
Installing Amazon.Lambda.Tools Global Tool
executing dotnet: ['dotnet', 'tool', 'install', '-g', 'Amazon.Lambda.Tools', '--ignore-failed-sources']
You can invoke the tool using the following command: dotnet-lambda

Tool 'amazon.lambda.tools' (version '5.9.0') was successfully installed.
DotnetCliPackageBuilder:GlobalToolInstall succeeded
 Running DotnetCliPackageBuilder:RunPackageAction
Running `dotnet lambda package` in /tmp/samcli/source
executing dotnet: ['dotnet', 'lambda', 'package', '--output-package', '/tmp/samcli/artifacts/source.zip', '--function-architecture', 'x86_64', '--msbuild-parameters', '--runtime linux-x64']
Amazon Lambda Tools for .NET Core applications (5.9.0)
Project Home: https:/aws/aws-extensions-for-dotnet-cli, https:/aws/aws-lambda-dotnet

Executing publish command
Deleted previous publish folder
... invoking 'dotnet publish', working folder '/tmp/samcli/source/bin/Release/net6.0/publish'
... dotnet publish "/tmp/samcli/source" --output "/tmp/samcli/source/bin/Release/net6.0/publish" --configuration "Release" --framework "net6.0" --runtime linux-x64 /p:GenerateRuntimeConfigurationFiles=true --self-contained False 
... publish: MSBuild version 17.3.2+561848881 for .NET
... publish:   Determining projects to restore...
... publish:   Restored /tmp/samcli/source/NewDevDataProcStack.csproj (in 12.87 sec).
... publish:   NewDevDataProcStack -> /tmp/samcli/source/bin/Release/net6.0/linux-x64/NewDevDataProcStack.dll
... publish:   NewDevDataProcStack -> /tmp/samcli/source/bin/Release/net6.0/publish/
Changed permissions on published file (chmod +rx Amazon.Lambda.Core.dll).
Changed permissions on published file (chmod +rx Amazon.Lambda.Serialization.SystemTextJson.dll).
Changed permissions on published file (chmod +rx NewDevDataProcStack.dll).
Changed permissions on published file (chmod +rx NewDevDataProcStack.deps.json).
Changed permissions on published file (chmod +rx NewDevDataProcStack.pdb).
Changed permissions on published file (chmod +rx NewDevDataProcStack.runtimeconfig.json).
Zipping publish folder /tmp/samcli/source/bin/Release/net6.0/publish to /tmp/samcli/artifacts/source.zip
Creating directory /tmp/samcli/artifacts
... zipping:   adding: Amazon.Lambda.Core.dll (deflated 56%)
... zipping:   adding: Amazon.Lambda.Serialization.SystemTextJson.dll (deflated 49%)
... zipping:   adding: NewDevDataProcStack.dll (deflated 59%)
... zipping:   adding: NewDevDataProcStack.deps.json (deflated 68%)
... zipping:   adding: NewDevDataProcStack.pdb (deflated 42%)
... zipping:   adding: NewDevDataProcStack.runtimeconfig.json (deflated 32%)
Created publish archive (/tmp/samcli/artifacts/source.zip).
Lambda project successfully packaged: /tmp/samcli/artifacts/source.zip
DotnetCliPackageBuilder:RunPackageAction succeeded
2023-12-01 12:45:24,707 | Build inside container returned response {"jsonrpc": "2.0", "id": 1, "result": {"artifacts_dir": "/tmp/samcli/artifacts"}}                                          
2023-12-01 12:45:24,713 | Build inside container was successful. Copying artifacts from container to host                                                                                     
2023-12-01 12:45:27,871 | Copying from container: /tmp/samcli/artifacts/. ->                                                                                                                  
/home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/.aws-sam/build/helloFromLambdaFunction                                                                   
2023-12-01 12:45:30,191 | Successfully removed temporary directory                                                                                                                            
/home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/.aws-sam/build/tmp-6fe422ec32e44c29ad77d440805c4a5a on the host.                                         
2023-12-01 12:45:30,197 | Build inside container succeeded                                                                                                                                    
2023-12-01 12:45:30,459 | Async execution completed                                                                                                                                           
2023-12-01 12:45:30,523 | There is no customer defined id or cdk path defined for resource helloFromLambdaFunction, so we will use the resource logical id as the resource id                 
2023-12-01 12:45:30,525 | 1 resources found in the stack                                                                                                                                      
2023-12-01 12:45:30,525 | Found Serverless function with name='helloFromLambdaFunction' and CodeUri='./src/NewDevDataProcStack/'                                                           

Build Succeeded

Built Artifacts  : .aws-sam/build
Built Template   : .aws-sam/build/template.yaml

Commands you can use next
=========================
[*] Validate SAM template: sam validate
[*] Invoke Function: sam local invoke
[*] Test Function in the Cloud: sam sync --stack-name {{stack-name}} --watch
[*] Deploy: sam deploy --guided
2023-12-01 12:45:32,485 | Installed version 1.103.0, current version 1.103.0                                                                                                                  
2023-12-01 12:45:32,689 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics                                                          
2023-12-01 12:45:34,592 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics                                                          
2023-12-01 12:45:34,596 | Unable to find Click Context for getting session_id.                                                                                                                
2023-12-01 12:45:34,602 | Sending Telemetry: {'metrics': [{'events': {'requestId': '90107e8c-2822-4879-8ed4-08bc2de41c8e', 'installationId': '11752e67-df08-4045-9099-f661e360e8ca',          
'sessionId': 'f769ede1-eb95-4d5c-bb96-ab9c5f5e508c', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.11.3', 'samcliVersion': '1.103.0', 'commandName': 'sam build',               
'metricSpecificAttributes': {'events': [{'event_name': 'SamConfigFileExtension', 'event_value': '.toml', 'thread_id': '207b5761bdac4453ace9b0772ef7af07', 'time_stamp': '2023-12-01           
20:37:24.361', 'exception_name': None}, {'event_name': 'SamConfigFileExtension', 'event_value': '.toml', 'thread_id': 'f5a599aa65e941d58e769231607a2ef7', 'time_stamp': '2023-12-01           
20:37:24.406', 'exception_name': None}, {'event_name': 'BuildWorkflowUsed', 'event_value': 'dotnet-cli-package', 'thread_id': '67c252fe61e5427ca41bd594895c9fde', 'time_stamp': '2023-12-01   
20:37:24.858', 'exception_name': None}, {'event_name': 'BuildFunctionRuntime', 'event_value': 'dotnet6', 'thread_id': '63a60752077743568cba136b172e1cfe', 'time_stamp': '2023-12-01           
20:37:56.620', 'exception_name': None}, {'event_name': 'BuildWorkflowUsed', 'event_value': 'dotnet-cli-package', 'thread_id': '80e39336441a48958718373559024c5d', 'time_stamp': '2023-12-01   
20:37:56.688', 'exception_name': None}]}}}]}                                                                                                                                                  
2023-12-01 12:45:34,598 | Sending Telemetry: {'metrics': [{'commandRun': {'requestId': '03293d1e-5b1d-4e79-99fc-84e0d363daec', 'installationId': '11752e67-df08-4045-9099-f661e360e8ca',      
'sessionId': 'f769ede1-eb95-4d5c-bb96-ab9c5f5e508c', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.11.3', 'samcliVersion': '1.103.0', 'awsProfileProvided': False,              
'debugFlagProvided': True, 'region': '', 'commandName': 'sam build', 'metricSpecificAttributes': {'projectType': 'CFN', 'gitOrigin': None, 'projectName':                                     
'3eecfc43b8f9ce0236269f327f5ad04f1e82ac73b713b7b13e41086e67a2867c', 'initialCommit': None}, 'duration': 488282, 'exitReason': 'success', 'exitCode': 0}}]}                                    
2023-12-01 12:45:34,862 | Telemetry response: 200                                                                                                                                             
2023-12-01 12:45:34,866 | Telemetry response: 200

The output above makes it look like everything worked but, right as that finished running, the C# extension showed a pop-up directing me to the C# logs and this is what they had:

[Error - 12:45:30 PM] [LanguageServerProjectSystem] Failure while loading /home/devuser/Dev/testSAMHelloWorld/NewDevDataProcStack/NewDevDataProcStack/src/NewDevDataProcStack/NewDevDataProcStack.csproj: Package Amazon.Lambda.Core, version 2.1.0 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
[Info  - 12:45:30 PM] [LanguageServerProjectSystem] Completed (re)load of all projects in 00:00:26.6799091

So I'm not sure if the build was actually successful or not. It looks like the files were built but, based on the error message, was it actually successful?

Hopefully something in all of this information helps to point us in the right direction toward the issue and a resolution.

@jysheng123
Copy link
Contributor

Thanks, Im still taking a look at your response, but I see that after building it container it ran properly, could you test sam local invoke to see if it built properly, that may be a workaround for your issue. If the presence of the feed is an issue, could you test it with a simple lambda function like sam initing a project and adding the azure feed yourself and let me know what the outcome of that is? Thanks

@jysheng123 jysheng123 added blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale. and removed stage/needs-investigation Requires a deeper investigation labels Dec 6, 2023
@sriram-mv sriram-mv added area/build sam build command area/local/invoke sam local invoke command and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build sam build command area/local/invoke sam local invoke command blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale.
Projects
None yet
Development

No branches or pull requests

3 participants