Using Octopus Server 2021.2.7727, adding a NuGet feed to an on-premise Azure DevOps 2020 server. Receive the following exception.
2021-11-03 12:02:58.3813 6908 24 ERROR Unhandled error on request: GET https://vmdmzdeldev.actcosys.com/OctopusDeploy/api/Spaces-1/feeds/Feeds-1021/packages/search?term=d&take=10 80000094-0000-f200-b63f-84710c7967bb by SimTeam : Package feed returned 401 Unauthorised, check the username and password for this feed. Also attempt to connect using NuGet.exe.
System.Exception: Package feed returned 401 Unauthorised, check the username and password for this feed. Also attempt to connect using NuGet.exe.
at Octopus.Core.Packages.NuGet.ExternalHttpNuGetPackageFeed.SearchForPackagesNamedLike(String packageId, Int32 take, CancellationToken cancellationToken, Boolean exactPackageIdMatch) in C:\BuildAgent\work\eb99e602a96dd63\source\Octopus.Core\Packages\NuGet\ExternalHttpNuGetPackageFeed.cs:line 143
at Octopus.Core.Packages.NuGet.ExternalHttpNuGetPackageFeed.SearchPackages(String term, CancellationToken cancellationToken, ILog log, Int32& total, Int32 skip, Int32 take) in C:\BuildAgent\work\eb99e602a96dd63\source\Octopus.Core\Packages\NuGet\ExternalHttpNuGetPackageFeed.cs:line 71
at Octopus.Server.Web.Api.Actions.PackageSearchAction.SearchPackages(IPackageFeed repository, String term, Int32 skip, Int32 take, String feedId, ILog log) in C:\BuildAgent\work\eb99e602a96dd63\source\Octopus.Server\Web\Api\Actions\PackageSearchAction.cs:line 91
at Octopus.Server.Web.Api.Actions.PackageSearchAction.ExecuteRegistered() in C:\BuildAgent\work\eb99e602a96dd63\source\Octopus.Server\Web\Api\Actions\PackageSearchAction.cs:line 58
at Octopus.Server.Web.Infrastructure.Api.CustomResponder`1.Respond(TDescriptor options, NancyContext context) in C:\BuildAgent\work\eb99e602a96dd63\source\Octopus.Server\Web\Infrastructure\Api\CustomResponder.cs:line 288
at Octopus.Server.Web.Infrastructure.OctopusNancyModule.<>c__DisplayClass14_0.<get_Routes>b__1(Object o, CancellationToken x) in C:\BuildAgent\work\eb99e602a96dd63\source\Octopus.Server\Web\Infrastructure\OctopusNancyModule.cs:line 82
at Nancy.Routing.Route`1.Invoke(DynamicDictionary parameters, CancellationToken cancellationToken)
at Nancy.Routing.DefaultRouteInvoker.Invoke(Route route, CancellationToken cancellationToken, DynamicDictionary parameters, NancyContext context)
at Nancy.Routing.DefaultRequestDispatcher.Dispatch(NancyContext context, CancellationToken cancellationToken)
at Nancy.NancyEngine.InvokeRequestLifeCycle(NancyContext context, CancellationToken cancellationToken, IPipelines pipelines)
at Octopus.NancyOwin.NancyMiddleware.RequestComplete(NancyContext context, IDictionary`2 environment, CancellationToken cancellationToken) in C:\BuildAgent\work\eb99e602a96dd63\source\Octopus.Server\Owin\NancyMiddleware.cs:line 171
at Octopus.NancyOwin.NancyMiddleware.<>c__DisplayClass3_0.<<UseNancy>b__1>d.MoveNext() in C:\BuildAgent\work\eb99e602a96dd63\source\Octopus.Server\Owin\NancyMiddleware.cs:line 111
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Owin.WebSocketAcceptAdapter.<>c__DisplayClass6_0.<<AdaptWebSockets>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Builder.Extensions.MapWhenMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.HttpOverrides.HttpMethodOverrideMiddleware.Invoke(HttpContext context)
at Octopus.Server.Web.UnitOfWorkMiddleware.InvokeAsync(HttpContext httpContext, IUnitOfWork unitOfWork) in C:\BuildAgent\work\eb99e602a96dd63\source\Octopus.Server\Web\UnitOfWorkMiddleware.cs:line 47
at Octopus.Server.Web.UnitOfWorkMiddleware.InvokeAsync(HttpContext httpContext, IUnitOfWork unitOfWork) in C:\BuildAgent\work\eb99e602a96dd63\source\Octopus.Server\Web\UnitOfWorkMiddleware.cs:line 47
at Octopus.Server.Web.Middleware.OctopusClientOldVersionWarningMiddleware.InvokeAsync(HttpContext context, IAutomationContext automationContext) in C:\BuildAgent\work\eb99e602a96dd63\source\Octopus.Server\Web\Middleware\OctopusClientOldVersionWarningMiddleware.cs:line 38
at Octopus.Server.Web.Middleware.DynamicContentHeadersMiddleware.InvokeAsync(HttpContext context) in C:\BuildAgent\work\eb99e602a96dd63\source\Octopus.Server\Web\Middleware\DynamicContentHeadersMiddleware.cs:line 48
at Octopus.Server.Web.Middleware.MaintenanceModeMiddleware.InvokeAsync(HttpContext context) in C:\BuildAgent\work\eb99e602a96dd63\source\Octopus.Server\Web\Middleware\MaintenanceModeMiddleware.cs:line 55
at Octopus.Server.Web.Middleware.OctopusAuthenticationMiddleware.InvokeAsync(HttpContext context, CorrelationId correlationId) in C:\BuildAgent\work\eb99e602a96dd63\source\Octopus.Server\Web\Middleware\OctopusAuthenticationMiddleware.cs:line 67
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Octopus.Server.Web.Middleware.RequestLoggerMiddleware.InvokeAsync(HttpContext context) in C:\BuildAgent\work\eb99e602a96dd63\source\Octopus.Server\Web\Middleware\RequestLoggerMiddleware.cs:line 42
at Octopus.Server.Web.Middleware.TelemetryMiddleware.InvokeAsync(HttpContext context, CorrelationId correlationId) in C:\BuildAgent\work\eb99e602a96dd63\source\Octopus.Server\Web\Middleware\TelemetryMiddleware.cs:line 74
at Octopus.Server.Web.Middleware.ErrorHandlingMiddleware.InvokeAsync(HttpContext context, CorrelationId correlationId) in C:\BuildAgent\work\eb99e602a96dd63\source\Octopus.Server\Web\Middleware\ErrorHandlingMiddleware.cs:line 100
Attempted to reproduce with NuGet commandline
.\nuget.exe sources update -ConfigFile .\nuget.config -Name SIM-SQLSERVER -ValidAuthenticationTypes basic -Source https://.../nuget/v3/index.json -UserName "SIM-SQLServer" -Password [PATHERE]
.\nuget.exe list -ConfigFile .\nuget.config -Source SIM-SQLServer -Verbosity detailed
This works. Tested with NuGet Explorer. This works too. Use same PAT token for each test.
I did find some similar problem in 2017; but is marked as fixed. I did edit credentials and endpoint a few times. So I repeated with a server restart
Get-Service OC* | Restart-Service
Not sure what to do next.