Invoke-Webrequest causes octopus tentacle service to stop


I have a portal set-up with nodeJS that allows us to perform deployments through octopus which uses the REST API heavily. This has been running quite well with v1.6 for some time now and we’ve decided to migrate over to 2.0.

This all went well except in some of the power-shell steps we have some invoke-webrequest commands to post some deploy specific data back to the portal to be stored in a database. In v2.0 this was causing a system.nullReferenceException with the octopus logging. We found a workaround by either adding ‘| out–null’ to the end of the web request or placing the invoke web request object into a variable which then contained the response content from node.

The very strange thing was we had a situation with two web requests being made close together, the first would cause the exception, the request still being performed however, at this point the logging would stop, but the second request would still be made and performed then the octopus service would stop.

On the nodejs side of things we’re using express and all we was sending back was a string of either success or an error message. This was done by simply using the res.send(‘success’) where res’ is the response object provided by express.

Whilst the problem is bandaged up so to speak it would be nice to know what exactly is different between the two versions to cause this behaviour? Plus this information might be useful to others with a similar problem.


Thanks for letting us know about this, I can’t think of any changes we made between 1.6 and 2.0 that would cause such a problem (we’re just invoking powershell.exe under the hood). Could you share an example of what the script looks like?


Hi sorry for the late reply

The script is quite simple

  Write-Host "Setting the step complete"
  $Step = Invoke-WebRequest -Uri "$DeployServerName/request/updatestep?octopusid=$OctopusDeploymentId&step=2" -Method POST
  Write-Host "--Step Request: $step --"`

This is the revised version which we have been rolling with since I start this thread.

The original was

 Write-Host "Setting the step complete"
 Invoke-WebRequest -Uri "$DeployServerName/request/updatestep?octopusid=$OctopusDeploymentId&step=2" -Method POST

Since the change it has been working flawlessly however.