Deployment works if triggered manually but not from TeamCity

We use TeamCity with Octopus Deploy to build, test and deploy our projects. I am currently setting up the build process for a new project, and having trouble getting the deploy step to work.

When I deploy the application manually via the OD web app, it works fine.
But when I try to make this happen automatically as part of the TeamCity build, it fails. The release is created successfully, but the deploy step cannot find the package in the NuGet feed.

Here’s what the build log has to say:

[10:08:13][Step 3/4] Octopus Deploy (21s)
[10:08:13][Octopus Deploy] Running command: octo.exe create-release --server=“http://byggare:8081” --apikey=SECRET --project=“ReQtest.CreateBugFromEmailService” --enableservicemessages --version=“1.0.26” --deployto=“dev” --waitfordeployment --packageversion=1.0.26
[10:08:13][Octopus Deploy] Creating Octopus Deploy release
[10:08:13][Octopus Deploy] Octopus Command Line Tool, version 1.1.17.62
[10:08:13][Octopus Deploy]
[10:08:13][Octopus Deploy] Finding project: ReQtest.CreateBugFromEmailService
[10:08:13][Octopus Deploy] Handshaking with Octopus server: http://byggare:8081/api
[10:08:13][Octopus Deploy] Handshake successful. Octopus version: 1.6.3.1723; API version: 2.0.0
[10:08:13][Octopus Deploy] Finding environments…
[10:08:13][Octopus Deploy] Finding steps for project…
[10:08:13][Octopus Deploy] Release plan for release: 1.0.26
[10:08:13][Octopus Deploy] Steps:
[10:08:13][Octopus Deploy] # Name Version Source
[10:08:13][Octopus Deploy] — ---------------- --------------- ------------------------------------
[10:08:13][Octopus Deploy] 1 Deploy package 1.0.26 User specified
[10:08:13][Octopus Deploy]
[10:08:13][Octopus Deploy] Creating release…
[10:08:13][Octopus Deploy] Release created successfully!
[10:08:13][Octopus Deploy] ##teamcity[setParameter name=‘octo.releaseNumber’ value=‘1.0.26’]
[10:08:13][Octopus Deploy] Successfully scheduled release 1.0.26 for deployment to environment dev
[10:08:13][Octopus Deploy] Deployment has not yet finished. Time taken: 0s
[10:08:23][Octopus Deploy] Deployment has not yet finished. Time taken: 10s
[10:08:34][Octopus Deploy] Command error:
[10:08:34][Octopus Deploy] The task: ‘Deploy ReQtest.CreateBugFromEmailService release 1.0.26 to dev’ failed with the error: A child activity failed: The package could not be downloaded from NuGet. Please see the below errors for details. If you are getting a package verification error, try switching to a Windows File Share package repository to see if that helps.
[10:08:34][Octopus Deploy] Please see the deployment page for more details: http://byggare:8081/tasks/show/tasks-63118
[10:08:34][Octopus Deploy]
[10:08:34][Octopus Deploy] Octo.exe exit code: 2
[10:08:34][Step 3/4] Unable to create or deploy release. Please check the build log for details on the error.
[10:08:34][Step 3/4] Step Release (OctopusDeploy: Release) failed

The deployment page:

Downloading packages from NuGet servers

2013-12-19 09:08:13 INFO Making a list of packages to download

Download package ReQtest.CreateBugFromEmailService 1.0.26 from NuGet feed: TeamCity

2013-12-19 09:08:13 DEBUG Checking package cache for package ReQtest.CreateBugFromEmailService 1.0.26
2013-12-19 09:08:13 INFO Downloading NuGet package ReQtest.CreateBugFromEmailService 1.0.26 from feed: 'http://byggare:8080/guestAuth/app/nuget/v1/FeedService.svc/'
2013-12-19 09:08:13 DEBUG Downloaded packages will be stored in: C:\Octopus\Data\PackageCache\feeds-1
2013-12-19 09:08:13 DEBUG Finding package (attempt 1 of 5)
2013-12-19 09:08:14 ERROR Unable to download package: Could not find package ReQtest.CreateBugFromEmailService 1.0.26 in feed: ‘http://byggare:8080/guestAuth/app/nuget/v1/FeedService.svc/’ System.Exception: Could not find package ReQtest.CreateBugFromEmailService 1.0.26 in feed: 'http://byggare:8080/guestAuth/app/nuget/v1/FeedService.svc/'
at Octopus.Shared.Packages.PackageDownloader.FindPackage(Int32 attempt, PackageMetadata packageMetadata, IFeed feed, IActivityLog log) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Packages\PackageDownloader.cs:line 139
at Octopus.Shared.Packages.PackageDownloader.AttemptToFindAndDownloadPackage(Int32 attempt, PackageMetadata packageMetadata, IFeed feed, IActivityLog log, String cacheDirectory, IPackage& downloadedPackage, String& path) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Packages\PackageDownloader.cs:line 121
at Octopus.Shared.Packages.PackageDownloader.AttemptToDownload(PackageMetadata metadata, IFeed feed, IActivityLog log) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Packages\PackageDownloader.cs:line 84
2013-12-19 09:08:15 DEBUG Finding package (attempt 2 of 5)
… etc

And when I trigger a deployment of the same package manually, from the web app, it just works.

What’s happening?

After even more googling I finally found the answer at StackOverflow.

That little footnote at the bottom of the TeamCity Integration page was NOT easy to find!