Hi, I’m running into some trouble using the /api/variables/all API call.
Initially the call is returning:
“ErrorMessage”: “The resource ‘Projects-141’ was not found.”
Out of curiosity I cloned the Octopus server and took a look at the VariableSet table and removed the rows that were linked to that Project. This then resulted in several similar errors pointing to different Project IDs.
After removing all the relevant rows I then began receiving the following:
{ “ErrorMessage”: “Value cannot be null.\r\nParameter name: source”, “FullException”: “Value cannot be null.\r\nParameter name: source\r\nSystem.ArgumentNullException\r\n at System.Linq.Enumerable.Where[TSource](IEnumerable1 source, Func
2 predicate)\r\n at Octopus.Server.Web.Infrastructure.Security.VariablePermissions.<>c__DisplayClass0_0.b__1(VariableDeclaration v)\r\n at Octopus.Server.Web.Api.Actions.InaccessibleVariablesWillBeRemovedRule.<>c__DisplayClass17_0.b__0(IId x)\r\n at Octopus.Server.Web.Api.Actions.InaccessibleVariablesWillBeRemovedRule.<>c__DisplayClass13_0.b__2(VariableResource vr)\r\n at Octopus.Shared.Util.ListExtensions.RemoveWhere[TElement](IList1 source, Func
2 remove)\r\n at Octopus.Server.Web.Api.Actions.InaccessibleVariablesWillBeRemovedRule.FilterVariableSetResource(VariableSet set, VariableSetResource setResource)\r\n at Octopus.Server.Web.Api.Actions.InaccessibleVariablesWillBeRemovedRule.Filter(IList1 collection, ISpecialRuleContext context)\r\n at Octopus.Server.Web.Infrastructure.Api.Responder
1.ExecuteRules[TRule](Action2 ruleCallback)\r\n at Octopus.Server.Web.Infrastructure.Api.ListAllResponseDescriptor
2.Responder.Execute()\r\n at Octopus.Server.Web.Infrastructure.Api.Responder1.ExecuteRegistered()\r\n at Octopus.Server.Web.Infrastructure.Api.Responder
1.Respond(TDescriptor options, NancyContext context)\r\n at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)\r\n at Octopus.Server.Web.Infrastructure.OctopusNancyModule.<>c__DisplayClass14_0.<get_Routes>b__1(Object x)\r\n at Nancy.Routing.Route.<>c__DisplayClass4.b__3(Object parameters, CancellationToken context)” }
Now, I realise that this may (probably) be due to me removing rows from the database, so my first question is whether there is a way to resolve the issue with the variables referencing deleted projects?
I’m using version v2018.4.0 which I realise is wildly out of date, so if this is unsolvable without updating, then don’t worry about it.