Cannot read secret variables. "Call failed. The SSL Connection could not be established..."

I’m having multiple issues following an upgrade to 1.4.4. I’ll detail these in another thread, for now I have an urgent issue where my scripts are not running.

I’m unable to access secret variables, I get the message:
[12:07:31 PM] [WRN] Call failed. The SSL connection could not be established, see inner exception. GET https://localhost:443/api/v1/Job/8

[12:07:41 PM] [WRN] Call failed. The SSL connection could not be established, see inner exception. GET https://localhost:443/api/v1/Script/8

The simple script I’m running, to demonstrate the issue which is affecting my production scripts, is:
write-host $secret

How are you hosting PSU? Did you configure the SSL settings in the appsettings.json or is this in IIS?

Is there any way you can send me your full log?

Thanks for the quick reply. Not hosting PSU with IIS, I did configure appsettings.json to enable https. That is below.

I will send you the full log by email. Thanks again

{
“Kestrel”: {
“EndpointDefaults”: {
“Protocols”: “Http1”
},
“Endpoints”: {
“HTTP”: {
“Url”: “http://:80",
},
“HTTPS”: {
“Url”: "https://
:443”,
“Certificate”: {
“Path”: “C:\ProgramData\PowerShellUniversal\certificate.pfx”,
“Password”: “###”
}
}
}
},
“AllowedHosts”: “*”,
“Data”: {
“RepositoryPath”: “%ProgramData%\UniversalAutomation\Repository”,
“ConnectionString”: “%ProgramData%\UniversalAutomation\database.db”,
}
}

To anyone that runs into a similar issue:

We updated the appsettings.json to include the external URL for the HTTPS binding.

  "Api": {
    "Url": "https://myserver.domain"
  },

The other issue was the the environments did not have the variables set so they were not including the secret variables. The following will include all variables that you have defined.

New-PSUEnvironment -Name '7' -Path pwsh.exe -Variables @("*")
1 Like