Deployment fails on a specific machine due to [System.Net.WebRequest]::DefaultWebProxy being null

Hi

We are running Octopus Deploy 2.6.3.886. Today, on a specific machine, deployment started failing for all our projects. I tried a few things, including reinstalling the Tentacle, but nothing seemed to work.
Upon closer inspection of the log (attached with a few variable values redacted), I noticed the following error:

Running PowerShell script: C:\Octopus\Applications\DevTest\Vfl.Eartag.Web\1.6.5591.23919_8\Deploy.ps1
Property 'Credentials' cannot be found on this object; make sure it exists and is settable.
At C:\Octopus\Applications\DevTest\Vfl.Eartag.Web\1.6.5591.23919_8\Bootstrap.69ddc5fc-eb43-4b55-b60e-d7655eba4b8e.ps1:558 char:42
+ [System.Net.WebRequest]::DefaultWebProxy. <<<< Credentials = new-object System.Net.NetworkCredential([System.Text.Encoding]::UTF8.GetString([Convert]::FromBase64String("YQ==")), [System.Text.Encoding]::UTF8.etString([Convert]::FromBase64String("Yg==")))
+ CategoryInfo          : InvalidOperation: (Credentials:String) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : PropertyNotFound
PowerShell script returned a non-zero exit code: 1
Tentacle version 2.6.5.1010

By using a FileSystemWatcher script I was able to obtain a copy of Bootstrap.69ddc5fc-eb43-4b55-b60e-d7655eba4b8e.ps1 by copying it before Octopus deletes it. The problematic line seems to be

[System.Net.WebRequest]::DefaultWebProxy.Credentials = new-object System.Net.NetworkCredential([System.Text.Encoding]::UTF8.GetString([Convert]::FromBase64String("YQ==")), [System.Text.Encoding]::UTF8.GetString([Convert]::FromBase64String("Yg==")))

which fails, because [System.Net.WebRequest]::DefaultWebProxy is null on this particular machine.
It is seemingly inserted automatically by Octopus before calling Deploy.ps1:

$ConfirmPreference = "None"
$ErrorActionPreference = "Stop"
[System.Net.WebRequest]::DefaultWebProxy.Credentials = new-object System.Net.NetworkCredential([System.Text.Encoding]::UTF8.GetString([Convert]::FromBase64String("YQ==")), [System.Text.Encoding]::UTF8.GetString([Convert]::FromBase64String("Yg==")))
 Script modules:
 Invoke:
. 'C:\Octopus\Applications\DevTest\Vfl.Eartag.Web\1.6.5591.23919_8\Deploy.ps1'
if ((test-path variable:global:lastexitcode)) { exit $LastExitCode }

Reading the documentation suggest that it should pick up its value from IEs proxy setting or the

 <system.net>
    <defaultProxy useDefaultCredentials="true" />
  </system.net>

tag in the application config file.
I tried fiddling with both, launching IE as System using psexec and tweaking the Tentacle.exe.config, to no avail.
I also tried

  • running the Tentacle as a specific user (did not change anything, as [System.Net.WebRequest]::DefaultWebProxy stays null for that user as well)
  • changing the Tentacle setting to explicitly not use a proxy (the call is still inserted in Bootstrap…ps1)

Any ideas on how to resolve this?

TIA
Michael Christensen

ServerTasks-52110.log.txt (26 KB)

A quick follow-up: It turned out that the machine was unhealthy in a number of ways, including but not limited to having a blank machine.config. So we ended up reinstalling it.