Octopus Server returned an error: This operation is not supported for a relative URI

I’m trying to use API via Octopus.Client C# library. I’m trying to add a machine to an environment like this:

        var machine = repository.Machines.Get(machineId);

        machine.EnvironmentIds.Add(environmentId);

        var updated = repository.Machines.Modify(machine);

But I get the exception:

{"Octopus Server returned an error: This operation is not supported for a relative URI.
Server exception:
System.InvalidOperationException: This operation is not supported for a relative URI.
at System.Uri.get_Scheme()
at Octopus.Server.Web.Api.Rules.PassiveTentacleUriMustBeHttpsRule.AfterMapBeforeStore(Machine model, MachineResource resource, ISpecialRuleContext context) in y:\work\refs\heads\master\source\Octopus.Server\Web\Api\Rules\PassiveTentacleUriMustBeHttpsRule.cs:line 17
at Octopus.Platform.Web.Api.Responder1.ExecuteRules[TRule](Action2 ruleCallback) in y:\work\refs\heads\master\source\Octopus.Platform.Web\Api\Responder.cs:line 185
at Octopus.Platform.Web.Api.ModifyResponseDescriptor2.Responder.Execute() in y:\\work\\refs\\heads\\master\\source\\Octopus.Platform.Web\\Api\\ModifyResponseDescriptor.cs:line 58 at Octopus.Platform.Web.Api.Responder1.Respond(TDescriptor options, NancyContext context) in y:\work\refs\heads\master\source\Octopus.Platform.Web\Api\Responder.cs:line 163
at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
at CallSite.Target(Closure , CallSite , Object , Object , NancyContext )
at Octopus.Server.Web.Api.OctopusRestApiModule.<>c__DisplayClass5.<.ctor>b__2(Object o) in y:\work\refs\heads\master\source\Octopus.Server\Web\Api\OctopusRestApiModule.cs:line 47
at CallSite.Target(Closure , CallSite , Func`2 , Object )
at Nancy.Routing.Route.<>c__DisplayClass4.b__3(Object parameters, CancellationToken context)

"}

All the Id’s I got from the API, so they are correct. And when I step through debugging, I can see list of environments in the machine.

What am I doing wrong?

Hi Trailmax,

Thanks for getting in touch!

It looks as if there’s an issue with the tentacle URI when it’s saved again. I’m wondering whether the URI has been added incorrectly?

Are you able to show me the details of the Machine you’ve retrieved?

Can you also tell me which version of Octopus you’re using?

Thanks,
Damo

Damian, thanks for helping with this.

Tentacle URI? where would I check that?

Here is how the machine object looks when I GET it first:

{
  "Id": "machines-130",
  "Name": "MyServerName",
  "Thumbprint": "MyThumbprintA4aA4A4A4A4aaA",
  "Uri": null,
  "IsDisabled": false,
  "EnvironmentIds": [
    "Environments-129",
    "Environments-357",
    "Environments-385",
    "Environments-386"
  ],
  "Roles": [
    "MyServerRole"
  ],
  "Status": 0,
  "StatusSummary": "Octopus was able to successfully establish a connection with this machine on 01 October 2015 02:00",
  "Endpoint": null,
  "LastModifiedOn": "2015-09-22T12:15:38.75+01:00",
  "LastModifiedBy": "Max@mydomain.co.uk",
  "Links": {
    "Self": {},
    "Connection": {}
  }
}

It is a polling tentacle. Could it be a problem?

Hi,

Ah yes, Polling tentacles don’t have a Uri because the Octopus Server doesn’t connect to them directly.
You’ll see in the json you pasted that the Uri property is null. It should still work, however. It’s likely that the server isn’t identifying your machine as a polling tentacle when you save it back.

Can you tell me what version of Octopus you are using?

Thanks,
Damo

Yes, sorry, missed that bit. We are on 2.6.3

Max
Sent from a phone. Typos are guaratneed

Hi,

Thanks for that. Are you able to confirm what version of the octo.exe tool you’re using?

I have a suspicion it’s trying to apply new rules we added in 3.0 to data from your 2.6 instance.

Thanks,
Damo

Damian,
it is a nuget package I’m using, not octo.exe. But you raise a very valid question - I’m using Octopus.Client.dll version 3.1.2. I’ll downgrade to 2.6.5 and will try again. I’ll let you know here how it works out.

Cheers,
Max

Damian,

Yep, the earlier version of nuget worked fine this time. Thanks for your help!

Max

Hi Max,

Excellent, I’m glad we solved it!

Damo