aws-lambda-dotnet
aws-lambda-dotnet copied to clipboard
Error configuring .NET CLI AWS Lambda deployment tools
Describe the bug
Unable to publish Lambda function using Publish-AWSPowerShellLambda getting below error.
Restoring .NET Lambda deployment tool Exception: C:\Users\xxxxxxx\OneDrive\Documents\PowerShell\Modules\AWSLambdaPSCore\3.0.1.0\Private\_DeploymentFunctions.ps1:402 Line | 402 | throw $msg | ~~~~~~~~~~ | Error configuring .NET CLI AWS Lambda deployment tools: 1 CALLSTACK: Command Arguments ------- --------- | _configureAmazonLambdaTools {} | _deployProject {FunctionHandler=Lambda _Function_Name::Lambda _Function_Name.Bootstrap::ExecuteFunction, BuildDirectory=C:\Users\xxxxxxx\AppData\Local\Temp\Lambda _Function_Name, AWSSessionToken=, | FunctionSecurityGroups=, FunctionMemor… Publish-AWSPowerShellLambda {ProfileName=AWS-PROD, Region=us-west=2, ScriptPath=C:\Users\xxxxxxx\OneDrive\Personal\Scripts\Lambda _Function_Name\Lambda _Function_Name.ps1, Name=Lambda _Function_Name, Timeout=900} <ScriptBlock> {}
Expected Behavior
The PowerShell script should be get update into the specific lambda function in the specific AWS account and region
Current Behavior
Restoring .NET Lambda deployment tool Exception: C:\Users\xxxxxxx\OneDrive\Documents\PowerShell\Modules\AWSLambdaPSCore\3.0.1.0\Private\_DeploymentFunctions.ps1:402 Line | 402 | throw $msg | ~~~~~~~~~~ | Error configuring .NET CLI AWS Lambda deployment tools: 1 CALLSTACK: Command Arguments ------- --------- | _configureAmazonLambdaTools {} | _deployProject {FunctionHandler=Lambda _Function_Name::Lambda _Function_Name.Bootstrap::ExecuteFunction, BuildDirectory=C:\Users\xxxxxxx\AppData\Local\Temp\Lambda _Function_Name, AWSSessionToken=, | FunctionSecurityGroups=, FunctionMemor… Publish-AWSPowerShellLambda {ProfileName=AWS-PROD, Region=us-west=2, ScriptPath=C:\Users\xxxxxxx\OneDrive\Personal\Scripts\Lambda _Function_Name\Lambda _Function_Name.ps1, Name=Lambda _Function_Name, Timeout=900} <ScriptBlock> {}
Reproduction Steps
NA
Possible Solution
No response
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
.NET SDKs installed: 6.0.302
Targeted .NET Platform
.NET SDKs installed: 6.0.302
Operating System and version
Windows 10 (10.0.19044)
Hi @msaravanaganesh,
Good morning.
Thanks for posting the issue. Looks like the script is unable to configuring .NET CLI AWS Lambda deployment tools and the error is thrown at https://github.com/aws/aws-lambda-dotnet/blob/04a0249fe10e1beb32fe0e73d7aa10f93ba25ccb/PowerShell/Module/Private/_DeploymentFunctions.ps1#L402
The exception is thrown after executing command to install/update .NET Global Tool Amazon.Lambda.Tools. Could you try running the Publish-AWSPowerShellLambda
as an Administrator along with -Verbose
flag and see if it works? You could also try executing command dotnet tool update -g Amazon.Lambda.Tools
separately and see if it succeeds (since this is the command which is having issues, may be due to privileges).
Thanks, Ashish
Hi @ashishdhingra
Thanks for your reply, I had tried to publish the lambda function as administrator bust still getting the same error.
I tried update the AWS.Lambda.Tools with the given command "dotnet tool update -g Amazon.Lambda.Tools" but that fails
dotnet tool update -g Amazon.Lambda.Tools C:\Users\u107524\AppData\Local\Temp\x0dk5kcl.1yn\restore.csproj : error NU1100: Unable to resolve 'amazon.lambda.tools (>= 0.0.0)' for 'net6.0'. C:\Users\u107524\AppData\Local\Temp\x0dk5kcl.1yn\restore.csproj : error NU1100: Unable to resolve 'amazon.lambda.tools (>= 0.0.0)' for 'net6.0/any'. 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.
Still struggling to fix, I hope I tried all the possibilities, created a AWS case too but they also suggest to work in the gitHub
Hi @msaravanaganesh
I was having the exact same problem, and found a solution here on the Microsoft forums - Dotnet fails to install tools
running dotnet nuget list source
showed an empty source list, and then running dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org
to add the default nuget source
After that I was able to run dotnet tool update -g Amazon.Lambda.Tools
and the Publish-AWSPowerShellLambda
I was trying
Hope that helps
@markgilbert-git
Amazing yes it worked.
But any idea how and what happen suddenly end up .Net issue.
the same system was working earlier without any issues.
@msaravanaganesh Now that I can't explain, mine was a fresh install of the .Net SDK and the problem was present there
@markgilbert-git Thanks for your guidance.