Object Reference error when updating variable set

Receiving Object Reference error when updating variable set through the API. I’m including the version. This started occurring after updating to 2020.5.8.

System.NullReferenceException: Object reference not set to an instance of an object.

  • at Octopus.Server.Web.Api.Actions.VariableSetUpdateAction.<>c__DisplayClass22_0.b__2(ReferenceDataItem e1) in C:\buildAgent\work\f014c79b193351c2\source\Octopus.Server\Web\Api\Actions\VariableSetUpdateAction.cs:line 283*
  • at System.Linq.Enumerable.Any[TSource](IEnumerable1 source, Func2 predicate)*

I did a GET on https://octopus.test.com/api/Spaces-1/variables/variableset-LibraryVariableSets-4
Took the response, made my change and PUT on https://octopus.test.com/api/Spaces-1/variables/variableset-LibraryVariableSets-4

{
     "Id": "variableset-LibraryVariableSets-4",
    "OwnerId": "LibraryVariableSets-4",
    "Version": 2539,
    "Variables": [
        {
                    
            "Id": "123ABC",
            "Name": "TestApiExternalRefreshToken",
            "Value": "123",
            "Description": null,
            "Scope": {
                "Machine": [
                    "Machines-602"
                ]
            },
            "IsEditable": true,
            "Prompt": null,
            "Type": "String",
            "IsSensitive": false
        }
    ]
}

Hi @lmandersoni,

Thanks for getting in touch! I will need some further information to get a better idea what could be going wrong here.

Would you be able to provide the script you are using to make these changes? (remove any sensitive information such as url/api key)

You mention upgrading to 2020.5.8, did this same script work before the upgrade? If so, which version did you upgrade from?

I think the above bits of information will help me get started with some testing and I can try to identify what is going wrong here.

Looking forward to hearing from you.

Best regards,
Daniel

Hi Daniel,

We were on 2020.1.15. I was able to update the variable set through Postman. octopus.py (9.7 KB)
Here is the script that was working.

Thanks- L

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.