Nuget Feed error after v2021.1 Upgrade - 502 Invalid argument

Since upgrading to v2021.1 i am getting a “502 Invalid Argument” error when connecting to my Teamcity server.

When testing the NuGet connection from the External Feeds page it gives this response:

The V2 feed at 'http://localhost:8085/httpAuth/app/nuget/v1/FeedService.svc/Search()?$filter=IsAbsoluteLatestVersion&searchTerm='MySearchTerm'&targetFramework=''&includePrerelease=true&$skip=0&$top=10&semVerLevel=2.0.0' returned an unexpected status code '502 Invalid argument'.

From the Acquire Packages build step it gives this error:

Acquiring packages 
June 11th 2021 14:28:24Info
Making a list of packages to acquire 
June 11th 2021 14:30:07Fatal
The step failed: Activity failed with error 'The package xx.xx.xx v1.2106.263 could not be downloaded to the package cache from NuGet feed 'TeamcityFeedXXX' after making 5 attempts over a total of 102s. Make sure the package is pushed to the feed and try the deployment again. For a detailed troubleshooting guide go to http://g.octopushq.com/TroubleshootMissingPackages
System.Exception: Unable to download package xx.xxx.xxx v1.2106.263 from NuGet feed 'TeamcityAUTH': The V2 feed at 'http://localhost:8085/httpAuth/app/nuget/v1/FeedService.svc/Packages(Id='xx.xxx.xx',Version='1.2106.263')' returned an unexpected status code '502 Invalid argument'.
 ---> NuGet.Protocol.Core.Types.FatalProtocolException: The V2 feed at 'http://localhost:8085/httpAuth/app/nuget/v1/FeedService.svc/Packages(Id='xx.xxx.xxx',Version='1.2106.263')' returned an unexpected status code '502 Invalid argument'.
   at NuGet.Protocol.V2FeedParser.<>c__DisplayClass53_0.<<LoadXmlAsync>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at NuGet.Protocol.HttpSource.ProcessResponseAsyncT
   at NuGet.Protocol.V2FeedParser.LoadXmlAsync(String uri, Boolean ignoreNotFounds, ILogger log, CancellationToken token)
   at NuGet.Protocol.V2FeedParser.QueryV2Feed(String relativeUri, String id, Int32 max, Boolean ignoreNotFounds, ILogger log, CancellationToken token)
   at NuGet.Protocol.V2FeedParser.GetPackage(PackageIdentity package, ILogger log, CancellationToken token)
   at Octopus.Core.Packages.NuGet.NuGetV2DownloadResource.DownloadPackage(PackageIdentity package, Action`1 process) in C:\BuildAgent\work\c42ca9d2b8233f1c\source\Octopus.Core\Packages\NuGet\NuGetV2DownloadResource.cs:line 26
   at Octopus.Shared.Util.TaskExtensions.PrepareForRethrow(Exception exception)
   at Octopus.Shared.Util.TaskExtensions.SafeResult[T](Task`1 task, CancellationToken cancellationToken)
   at Octopus.Core.Packages.NuGet.ExternalHttpNuGetPackageFeed.DownloadPackageToLocalCache(String packageId, IVersion version, ITaskContext taskContext, ILogContext logContext) in C:\BuildAgent\work\c42ca9d2b8233f1c\source\Octopus.Core\Packages\NuGet\ExternalHttpNuGetPackageFeed.cs:line 183
   --- End of inner exception stack trace ---
   at Octopus.Core.Packages.NuGet.ExternalHttpNuGetPackageFeed.DownloadPackageToLocalCache(String packageId, IVersion version, ITaskContext taskContext, ILogContext logContext) in C:\BuildAgent\work\c42ca9d2b8233f1c\source\Octopus.Core\Packages\NuGet\ExternalHttpNuGetPackageFeed.cs:line 208
   at Octopus.Core.Packages.DeploymentPackageDownloader.<>c__DisplayClass8_0.<DownloadPackage>b__0() in C:\BuildAgent\work\c42ca9d2b8233f1c\source\Octopus.Core\Packages\DeploymentPackageDownloader.cs:line 77'.

Hi Pete,

Thanks for getting in touch with us and sorry to hear you’re having issues connecting to your NuGet feed after the upgrade.

Which version of Octopus Server did you upgrade from? This may help us in narrowing down the issue.

We noticed from the log section you posted the feed is expecting V2, but the external feed shows it’s connecting to a V1 feed:

http://localhost:8085/httpAuth/app/nuget/v1/FeedService.svc/Packages(Id='xx.xxx.xx',Version='1.2106.263')

Is there a chance there is some difference in configuration here, or would it be possible to use the V2 version for the feed? As in the following:

http://localhost:8085/httpAuth/app/nuget/v2/FeedService.svc/Packages(Id='xx.xxx.xx',Version='1.2106.263')

It looks like this should be possible based on the TeamCity documentation, so hopefully, your version allows this: Using TeamCity as NuGet Feed | TeamCity On-Premises

Please let us know if that helps, and I’m looking forward to hearing back from you.

Best,
Patrick

Hi Thanks,

The upgrade was from version 2019.3.3

I have updated to v2 feed, but it still gives the same message:
`

The V2 feed at ‘http://localhost:8085/httpAuth/app/nuget/feed/_Root/default/v2/Search()?$filter=IsAbsoluteLatestVersion&searchTerm=‘mpm’&targetFramework=’’&includePrerelease=true&$skip=0&$top=10&semVerLevel=2.0.0’ returned an unexpected status code ‘502 Invalid argument’.

`

Note the above url, works fine in a web browser on the server.

Thanks

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.