aws / aws-extensions-for-dotnet-cli

Extensions to the dotnet CLI to simplify the process of building and publishing .NET Core applications to AWS services
Apache License 2.0
369 stars 86 forks source link

Cant install lambda tools #325

Closed deanchalk closed 3 days ago

deanchalk commented 4 days ago

Describe the bug

When attempting to run the following command: dotnet tool install -g Amazon.Lambda.Tools I get the following error:

Unhandled exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at NuGet.Protocol.PackageMetadataResourceV3.GetMetadataAsync(String packageId, Boolean includePrerelease, Boolean includeUnlisted, VersionRange range, SourceCacheContext sourceCacheContext, ILogger log, CancellationToken token)
   at NuGet.Protocol.PackageMetadataResourceV3.GetMetadataAsync(String packageId, Boolean includePrerelease, Boolean includeUnlisted, SourceCacheContext sourceCacheContext, ILogger log, CancellationToken token)
   at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.GetPackageMetadataAsync(PackageSource source, String packageIdentifier, Boolean includePrerelease, Boolean includeUnlisted, CancellationToken cancellationToken)
   at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.GetMatchingVersionInternalAsync(String packageIdentifier, IEnumerable`1 packageSources, VersionRange versionRange, CancellationToken cancellationToken)
   at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.GetBestPackageVersionAsync(PackageId packageId, VersionRange versionRange, PackageSourceLocation packageSourceLocation)
   at Microsoft.DotNet.Cli.ToolPackage.ToolPackageDownloader.<>c__DisplayClass8_0.<InstallPackage>b__0()
   at Microsoft.DotNet.Cli.TransactionalAction.Run[T](Func`1 action, Action commit, Action rollback)
   at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.<>c__DisplayClass20_0.<Execute>b__1()
   at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.RunWithHandlingInstallError(Action installAction)
   at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.Execute()
   at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult)
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)

Expected Behavior

The tools should be installed correctly

Current Behavior

the tool does not get installed

Reproduction Steps

try and run the following command in the terminal - dotnet tool install -g Amazon.Lambda.Tools

Possible Solution

No response

Additional Information/Context

I have both .net 6 and .net 8 SDKs installed on my M1 Macbook Pro

AWS .NET SDK and/or Package version used

N/A

Targeted .NET Platform

N/A

Operating System and version

Macos Sonoma

ashishdhingra commented 4 days ago

@deanchalk Good morning. Looking at the stack trace, error appears to be happening while inspecting package metadata via NuGet. So either NuGet had intermittent connectivity issues or your network blocks connectivity to NuGet. Are you installing this in company network environment. If yes, could you try switching to a different network and try again.

Kindly note that this issue is not with AWS .NET CLI extensions. You are executing basic dotnet tool install command provided by .NET CLI.

Thanks, Ashish