OctopusDeploy version 2018.3.3
We make a call to Get-OctopusProject to return a list of projects as part of our build. At intermittent intervals (that generally seem to coincide with the server having multiple deployments running at the same time), the call will result in:
PS C:\Users\mynamehere> Get-OctopusProject
Get-OctopusProject : Sequence contains no elements
At line:1 char:1
+ Get-OctopusProject
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ( [Get-OctopusProject], InvalidOperationException
+ FullyQualifiedErrorId : System.InvalidOperationException,Octoposh.Cmdlets.GetOctopusProject
Any suggestions for what I can check? The Octopus log files in c:\Octopus\Logs don’t have anything relevant.
Get-OctopusProject makes a call to the /api/projects/all endpoint. It sounds like the call to the endpoint is timing out and returning no results. To help diagnose you can hit that endpoint manually (https://your-octopus/api/projects/all) to see if it takes a long time to return. The Octopus server logs should also contain records indicating long-running requests, something like:
2018-11-13 23:00:19.2062 5068 229 INFO Request took 21316ms: GET https://your-octopus/api/projects/all
Is your Octopus server using a lot of resources while running multiple deployments at the same time?
Thanks for replying. End of sprint is over, so it’s a bit quieter now, the error isn’t occurring at the moment. When it does, I’ll try hitting that endpoint directly.
The server doesn’t appear to be struggling from a resource perspective, CPU/Memory/disk response all seems reasonable enough at the time.
I still feel it’s a slow request, would it be possible to put a stopwatch before and after the call in your build script to see if that reveals anything?
An alternative would be to use Octopus.Client directly instead of via OctoPosh to see if it makes any difference.
Sorry for the delay, it’s mostly been behaving itself. The team would prefer to stay with Octoposh, as pretty much everything else in these scripts is native powershell. But some additional information.
This error crops up when we have a deployment that has failed and is awaiting intervention. Octoposh gets into here:
public List GetOctopusProject(List baseResourceList)
It then throws an error while processing the dashboardItems. Exactly what, I don’t have, because I had to get stuff working again, so the intervention was processed and status returned to normal.