Show the y axis get a error with polyline entity

I want to draw a line show the y axis of the earth
the code is below:
//show the y axis
let arrCartesianY = [
new Cesium.Cartesian3(0, 0, 0),
new Cesium.Cartesian3(0, 9000 * 1000, 0),
]
viewer.entities.add({
name: “Y axes”,
polyline: {
positions: arrCartesianY,
width: 10,
arcType: Cesium.ArcType.NONE,
material: new Cesium.PolylineArrowMaterialProperty(Cesium.Color.GREEN)
},
})
but it have a error below:

i want to know,why is there a error,and how to fix it,thank you

I didnt try your code. But similar error happend to me.
My error was because i used ‘let’ instead of ‘var’.

Now, i think, the ‘scope’ is ended, so your arrCartesianY destroyed by your garbage collector!!!

So, to cocnclude, in my opinion based on logic, change your let arrCartesianY into var arrCartesianY.

Why does this happens?
The error occurs here.
In more detail this is because cartesianToCartographic returns undefined.

So why does Ellipsoid.prototype.cartesianToCartographic = function (cartesian, result) fail?
Because the length of cartesian is zero.

How to fix?
Please use another cartesian of which length is not zero instead of Cesium.Cartesian3(0, 0, 0).

For example,

let arrCartesianY = [
new Cesium.Cartesian3(1, 0, 0),
new Cesium.Cartesian3(0, 9000 * 1000, 0),
];

Screenshot_1

You can do something similar using geographic coordinates (lon, lat, height).

var viewer = new Cesium.Viewer(“cesiumContainer”);

var points = Cesium.Cartesian3.fromDegreesArrayHeights([0.0, 90.0, 0.0, 0.0, 90.0, 900000.0]);

viewer.entities.add({
name: ‘Y axis’,
polyline: {
positions: points,
width: 10,
arcType: Cesium.ArcType.NONE,
material: new Cesium.PolylineArrowMaterialProperty(Cesium.Color.GREEN)
},
});