Rendering has stopped due to TypeError: t[n].update is not a function

TypeError: t[n].update is not a function

TypeError: t[n].update is not a function
at qs.update (http://127.0.0.1:5500/v4.0.0/cesium/Cesium-1.112/Build/Cesium/Cesium.js:8318:110537)
at Ege (http://127.0.0.1:5500/v4.0.0/cesium/Cesium-1.112/Build/Cesium/Cesium.js:12496:31675)
at sg (http://127.0.0.1:5500/v4.0.0/cesium/Cesium-1.112/Build/Cesium/Cesium.js:12496:28461)
at Yi.updateAndExecuteCommands (http://127.0.0.1:5500/v4.0.0/cesium/Cesium-1.112/Build/Cesium/Cesium.js:12496:25729)
at Zht (http://127.0.0.1:5500/v4.0.0/cesium/Cesium-1.112/Build/Cesium/Cesium.js:12496:37431)
at TT (http://127.0.0.1:5500/v4.0.0/cesium/Cesium-1.112/Build/Cesium/Cesium.js:12496:37629)
at Yi.render (http://127.0.0.1:5500/v4.0.0/cesium/Cesium-1.112/Build/Cesium/Cesium.js:12496:38622)
at ST.render (http://127.0.0.1:5500/v4.0.0/cesium/Cesium-1.112/Build/Cesium/Cesium.js:12498:1631)
at n (http://127.0.0.1:5500/v4.0.0/cesium/Cesium-1.112/Build/Cesium/Cesium.js:12496:52908)

`viewer = new Cesium.Viewer("mapDiv", {
terrain: Cesium.Terrain.fromWorldTerrain(),
});

    setTimeout(() => {

        viewer.camera.flyTo({
            destination: Cesium.Cartesian3.fromDegrees(-74.019, 40.6912, 750),
            orientation: {
                heading: Cesium.Math.toRadians(20),
                pitch: Cesium.Math.toRadians(-20),
            },
            duration: 0,
        });

        const osmBuildingsTileset = Cesium.createOsmBuildingsAsync();
        viewer.scene.primitives.add(osmBuildingsTileset);

    }, 1000);`

Hi, welcome to using Cesium.

The issue is that you are passing a Promise<Cesium3DTileset> to primitives.add instead of a Cesium3DTileset. createOsmBuildingsAsync returns an promise so you will need to use await or then to get the tileset from it.

See this example sandcastle which loads the tileset.

I have also moved this to the CesiumJS category since this is more closely related to the CesiumJS Viewer instead of the Cesium ion hosting service.

1 Like