Can not run Octopus.Client on Octopus Server after upgrade from 2019.9.4 to 2019.12.1

Hi Octopus Support,
We are running the following code calling the Octopus Client API from an Octopus Process:

Add-Type -Path ‘D:\Program Files\Octopus Deploy\Octopus\Octopus.Client.dll’
$endpoint = New-Object Octopus.Client.OctopusServerEndpoint “https://od.tst.xxx.org”,“API-XXXXXX”
$repository = New-Object Octopus.Client.OctopusRepository $endpoint
$antal = $repository.Projects.FindAll().Count #This line fails after upgrade

It worked fine before the upgrade. After the upgrade we get the following error:
NotSpecified: Exception calling “FindAll” with “0” argument(s): “Unexpected character encountered while parsing value: <. Path ‘’, line 0, position 0.”
At D:\OctopusHomeProdCopy\Work\20200207105448-478527-3\Script.ps1:15 char:1

  • $antal = $repository.Projects.FindAll().Count

at , D:\OctopusHomeProdCopy\Work\20200207105448-478527-3\Script.ps1: line 15
at , D:\OctopusHomeProdCopy\Work\20200207105448-478527-3\Bootstrap.Script.ps1: line 11557
at , : line 1
at , : line 1
The remote script failed with exit code 1
The action Testa on the Octopus Server failed

We get this error both when running on the Octopus Server and when running on a tentacle on the Octopus Server. (Or on behalf of an other deployment target)

It still works on a tentacle on a different server but not on the Octopus Server.

Please Help

Thanks for getting in touch.

We’ve been unable to reproduce with your version, could you please confirm if you have any proxy servers configured in front of your Octopus Server?

What do you get when directly calling the projects endpoint from your Octopus Server machine? Can you go to https://od.tst.xxx.org/api/projects/all in an authenticated browser and let us know does it return valid JSON?

We downgraded our OD test server to 2019.9.4 and then upgraded to newer versions in succession. We found that the code works for versions up to 2019.9.12, but not for 2019.10.0 and newer. Your suspicion is correct. Thanks for pointing us in the right direction - we do use a server proxy and we can make the call to octopus work by adding an empty proxy to the endpoint. But we would like to know why it doesn’t work with our server proxy any more. The serverproxy has an exception for the xxx domain but that does not work any more. Did something happen in Octopus regarding this?

Glad to hear you got it sorted.

Did something happen in Octopus regarding this?

It’s a good question :thinking: I’ve done a bit of digging, and it looks like there was a proxy issue introduced in the version of Calamari bundled with 2019.10 that may be related: Web Request proxy not detecting bypass list · Issue #5953 · OctopusDeploy/Issues · GitHub

If that’s the same issue you’re experiencing, upgrading would be your best path forward. Alternatively you could use the below workaround to bypass this problem.

Upgrade: >= 2019.13.4

or

Workaround: Add the following to the start of the Powershell script:
[System.Net.WebRequest]::DefaultWebProxy = [System.Net.WebRequest]::GetSystemWebProxy()

I hope that helps!

We can confirm that the 2019.13.4 version works for us. However we prefer to use LTS in production. When will the #5953 fix be included in an LTS release?

Good call to stay on LTS :+1:

Because this issue has a workaround (setting the DefaultWebProxy via PowerShell), we do not plan on back-porting this fix to the LTS release. Are you able to confirm whether the PowerShell workaround solves the issue for you on your production instance?

Yes, we have tried the workaround and it works. :slight_smile: