Cannot retrieve the dynamic parameters for the cmdlet. Unexpected end when deserializing object


{tocify} $title={Table of Contents}



Issue


The issue is related to deployment, where I am deploying azure services using yaml files.

After getting prepared with the individual services deploy and paramenters json file, I tried to run the pipeline , it  gave me the below error


Unexpected end when deserializing object




 "Cannot retrieve the dynamic parameters for the cmdlet. Unexpected end when deserializing object. Path 'parameters', line 98, position 0."


Why it happened

As the error says there are two things to look at

1. dynamic parameters were not resolved
2. Issue while deserializing object

At runtime the parameters referred in yaml file are actually looked up in the parameters (json file) file and value of it is used . 

So to make sure if I haven't missed any of the parameters used , I crosschecked the parameter json file, all the parameters were there.

Still parameter resolution was not happening, why? - because of second point i.e. there was some issue with deserializing object.

First let's understand Serialization and deserialization

Serialization is the process of bringing an object into a form that it can be written on stream. It's the process of converting the object into a form so that it can be stored on a file, database, or memory; or, it can be transferred across the network. 

Thus the state of the object is saved so that it can be recreated when needed.

Deserialization is the process of getting back the serialized object so that it can be loaded into memory. It resurrects the state of the object by setting properties, fields etc.

Coming back to error , so the issue was that the parameters.json ( has parameters and it's value)  which is stored as JSON file is not getting deserialized.

And the line number mentioned in the error, helped to find the issue -- and it was missing closing braces. 

missing closing braces

So the file was not a valid JSON, thus the error.


What to do

To fix the issue, added the missing closing brace .


After the correction, services were happily deployed.

To avoid such trivial issue -  Always make sure to validate the JSON file (free online validator are available).


If you have questions or suggestions, feel free to do in comments section below !!!


Do share if you find this helpful .......
 
                          Knowledge Sharing is Caring !!!!!!




Post a Comment

If you have any suggestions or questions or want to share something then please drop a comment

Previous Post Next Post