I’m using TeamCity (9.1.6) with Octopus (3.3.6). As far as I can tell, nothing has changed since the last time I deployed changes to Octopus, but today no luck. I get a 401 Unauthorized error on my create release step. I get a similar error when attempting to test the TeamCity package feed from Octopus. Seems very much like a permission error, but I don’t know what permissions I’d be missing.
TeamCity Build Log:
[12:24:01]Step 5/5: Create Release (OctopusDeploy: Create release) (1m:16s)
[12:24:02][Step 5/5] Octopus Deploy (1m:16s)
[12:24:02][Octopus Deploy] Running command: octo.exe create-release --server http://**** --apikey SECRET --project **** --enableservicemessages --version 1.0.58.0 --deployto Development
...
[12:24:03][Octopus Deploy] Finding latest NuGet package for step: Deploy
[12:25:18][Octopus Deploy] Error from Octopus server (HTTP 500): Octopus Server returned an error: An error occurred while loading packages from 'http://****/httpAuth/app/nuget/v1/FeedService.svc/': The remote server returned an error: (401) Unauthorized.
[12:25:18][Octopus Deploy] Exit code: -7
[12:25:18][Octopus Deploy] Octo.exe exit code: -7
Octopus Server Log:
System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at System.Net.HttpWebRequest.GetResponse()
at NuGet.RequestHelper.GetResponse()
at NuGet.RedirectedHttpClient.GetResponseUri(HttpClient client)
at NuGet.RedirectedHttpClient.EnsureClient()
at System.Lazy`1.CreateValue()
at Octopus.Server.Web.Api.Actions.PackageSearchAction.Execute() in Y:\work\refs\tags\3.3.6\source\Octopus.Server\Web\Api\Actions\PackageSearchAction.cs:line 56
at Octopus.Server.Web.Infrastructure.Api.Responder`1.Respond(TDescriptor options, NancyContext context) in Y:\work\refs\tags\3.3.6\source\Octopus.Server\Web\Infrastructure\Api\Responder.cs:line 162
at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
at Octopus.Server.Web.Api.OctopusRestApiModule.<>c__DisplayClass0_0.<.ctor>b__0(Object o) in Y:\work\refs\tags\3.3.6\source\Octopus.Server\Web\Api\OctopusRestApiModule.cs:line 46
at Nancy.Routing.Route.<>c__DisplayClass4.b__3(Object parameters, CancellationToken context)
--- End of stack trace from previous location where exception was thrown ---
at System.Lazy`1.LazyInitValue()
at NuGet.MemoryCache.GetOrAdd[T](Object cacheKey, Func`1 factory, TimeSpan expiration, Boolean absoluteExpiration)
at NuGet.RedirectedHttpClient.get_CachedClient()
at NuGet.RedirectedHttpClient.get_Uri()
at NuGet.DataServicePackageRepository.get_Context()
at NuGet.DataServicePackageRepository.GetPackages()
at Octopus.Core.Packages.ExternalNuGetFeedAdapter.SearchForPackagesNamedLike(String packageId, Int32 take) in Y:\work\refs\tags\3.3.6\source\Octopus.Core\Packages\ExternalNuGetFeedAdapter.cs:line 86
at Octopus.Core.Packages.ExternalNuGetFeedAdapter.GetPackagesContaining(String searchTerm, Int32& total, Int32 skip, Int32 take, Boolean allowPreRelease) in Y:\work\refs\tags\3.3.6\source\Octopus.Core\Packages\ExternalNuGetFeedAdapter.cs:line 66
at Octopus.Server.Web.Api.Actions.PackageSearchAction.Search(String feedId, String packageId, Boolean partialMatch, Boolean includeMultipleVersions, Boolean includeNotes, Boolean includePreRelease, Int32 take, IVersionSpec versionRange, Regex preReleaseTag) in Y:\work\refs\tags\3.3.6\source\Octopus.Server\Web\Api\Actions\PackageSearchAction.cs:line 76
at Octopus.Server.Web.Api.Actions.PackageSearchAction.Execute() in Y:\work\refs\tags\3.3.6\source\Octopus.Server\Web\Api\Actions\PackageSearchAction.cs:line 56
at Octopus.Server.Web.Infrastructure.Api.Responder`1.Respond(TDescriptor options, NancyContext context) in Y:\work\refs\tags\3.3.6\source\Octopus.Server\Web\Infrastructure\Api\Responder.cs:line 162
at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
at Octopus.Server.Web.Api.OctopusRestApiModule.<>c__DisplayClass0_0.<.ctor>b__0(Object o) in Y:\work\refs\tags\3.3.6\source\Octopus.Server\Web\Api\OctopusRestApiModule.cs:line 46
at Nancy.Routing.Route.<>c__DisplayClass4.b__3(Object parameters, CancellationToken context)