Polygon using PositionPropertyArray

Attempted a shape changing polygon using PositionPropertyArray

var viewer = new Cesium.Viewer("cesiumContainer");

var jdnow = Cesium.JulianDate.now();
var optdate = new Cesium.JulianDate();
var v1 = new Cesium.SampledPositionProperty();
v1.addSample(Cesium.JulianDate.addMinutes(jdnow, 0, optdate), Cesium.Cartesian3.fromDegrees(-50, 10));
v1.addSample(Cesium.JulianDate.addMinutes(jdnow, 100, optdate), Cesium.Cartesian3.fromDegrees(-50, -10));

var v2 = new Cesium.SampledPositionProperty();
v2.addSample(Cesium.JulianDate.addMinutes(jdnow, 0, optdate), Cesium.Cartesian3.fromDegrees(-20, 10));
v2.addSample(Cesium.JulianDate.addMinutes(jdnow, 100, optdate), Cesium.Cartesian3.fromDegrees(-20, -10));

var v3 = new Cesium.SampledPositionProperty();
v3.addSample(Cesium.JulianDate.addMinutes(jdnow, 0, optdate), Cesium.Cartesian3.fromDegrees(-20, 40));
v3.addSample(Cesium.JulianDate.addMinutes(jdnow, 100, optdate), Cesium.Cartesian3.fromDegrees(-20, 50));

var v4 = new Cesium.SampledPositionProperty();
v4.addSample(Cesium.JulianDate.addMinutes(jdnow, 0, optdate), Cesium.Cartesian3.fromDegrees(-50, 40));
v4.addSample(Cesium.JulianDate.addMinutes(jdnow, 100, optdate), Cesium.Cartesian3.fromDegrees(-50, 50));

var cyanPolygon = viewer.entities.add({
  name: "Cyan polygon",
  polygon: {
    hierarchy: new Cesium.PositionPropertyArray([v1, v2, v3, v4]),
    //perPositionHeight: true,
    material: Cesium.Color.CYAN.withAlpha(0.5),
    outline: true,
    outlineColor: Cesium.Color.BLACK,
  },
});

but getting this error

An error occurred while rendering.  Rendering has stopped.
TypeError: Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
    at Function.PolygonGeometry.createGeometry (https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:79141:24)
    at loadSynchronous (https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:112729:48)
    at Primitive.update (https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:113529:9)
    at ClassificationPrimitive.update (https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:116496:21)
    at GroundPrimitive.update (https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:117458:21)
    at PrimitiveCollection.update (https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:196340:21)
    at OrderedGroundPrimitiveCollection.update (https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:196601:22)
    at PrimitiveCollection.update (https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:196340:21)
    at PrimitiveCollection.update (https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:196340:21)
    at updateAndRenderPrimitives (https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:282919:29)

Will be glad to know, where I erred… Thanks

Hi there,
Did you ever figure out this problem? I am running into the same issue and cannot figure it out for the life of me. Thank you!

Was someone able to find the solution to this? I have the same problem. If I paste the code below into the Cesium Sandcastle it works fine. But if I change from polyline/positions to polygon/hierarchy I get the mentioned error. From what I have read, it seems that it did work in older versions of Cesium.
Thanks!

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var start = Cesium.JulianDate.fromDate(new Date(Date.now()));
var stop = Cesium.JulianDate.addSeconds(start, 60, new Cesium.JulianDate());

var point1 = new Cesium.SampledPositionProperty();
point1.addSample(start, Cesium.Cartesian3.fromDegrees(-20, 30));
point1.addSample(stop, Cesium.Cartesian3.fromDegrees(20, 10));

var point2 = new Cesium.SampledPositionProperty();
point2.addSample(start, Cesium.Cartesian3.fromDegrees(-60, 20));
point2.addSample(stop, Cesium.Cartesian3.fromDegrees(20, -30));

var point3 = new Cesium.SampledPositionProperty();
point3.addSample(start, Cesium.Cartesian3.fromDegrees(30, -20));
point3.addSample(stop, Cesium.Cartesian3.fromDegrees(-10, 30));

var entity = viewer.entities.add({
polyline : {
positions : new Cesium.PositionPropertyArray([point1, point2, point3])
}
});