"[WARN] Call failed. An error occurred while sending the request." message in all jobs

"[WARN] Call failed. An error occurred while sending the request." message in all jobs

Version: Any

Root Cause
When PowerShell Universal starts a new job, it uses the Management API to retrieve job information from the server. It does this over HTTP and will generate a Read-Only app token for the identity of the user that started or scheduled the job. The web server uses internal APIs to determine the URL of the management API. If PowerShell Universal is hosted behind a remote proxy, like IIS, or cannot determine the web server URL, it will fail to connect and report the warning message:
[6:08:48 PM] [WRN] Call failed. An error occurred while sending the request. GET https://localhost/api/v1/Job/329

To resolve this issue, you will need to configure the application settings. This can be accomplished be editing the appsetting.json file, environment variables or command line arguments. You can learn more about application configuration settings on the documentation.
When using the appsettings.json file, you will need to update the API \ URL property to include the root of your web server address. For example, if your web server was listening on https://ironmanpsu:448,/ you could updated the JSON file like this.
  1.   "Api": {
  2.     "Url": "https://ironmanpsu:448"
  3.   },
Instead of trying to determine the API URL via internal APIs, PowerShell Universal will now pass this value to all PowerShell Environments (including jobs) so that the cmdlets use the proper URL.
    • Related Articles

    • "Did not receive port from client process." when running jobs

      Version: PowerShell Universal 2.x Problem: When executing jobs, jobs can fail without starting the PowerShell script. Within the PowerShell Universal logs, you will see an error that states: Did not receive port from client process. Root Cause: When ...
    • IIS: HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure

      Applies to: PowerShell Universal 1.4 or later When configuring PowerShell Universal to run under IIS, you may be presented with an error that states ANCM Out-Of-Process Startup Failure. This error can be presented for a variety of reasons but the ...
    • PowerShell Universal server crashes with error "Unable to cast object of type 'LiteDB.EmptyPage' to type 'LiteDB.DataPage'. "

      Version: 1.4.x Issue: An error is thrown when running jobs that states:       Error executing job 31: Unable to cast object of type 'LiteDB.EmptyPage' to type 'LiteDB.DataPage'.    at LiteDB.PageService.GetPage[T](UInt32 pageID) This only happens ...
    • Jobs not returning correctly from Get-PSUJob

      Version: 1.5 Issue: When running Get-PSUJob and passing in a script returned from Get-PSUScript, jobs may not be returned correctly.  Get-PSUScript -Name 'Script.ps1' | Get-PSUJob  Root Cause: If the Universal 1.4 PowerShell module is installed, and ...
    • Dashboard does not start

      Version: PowerShell Universal 2.x Problem: When attempting to start a dashboard, the dashboard either reports Start Failed or does not transition from Stopped.  Root Cause and Resolution: There can be multiple root causes for this issue. Each root ...