Error when switched on Cesium-1.107.1

There have been some breaking changes in version 107, and they are described in the change log for version 1.107. Many of them have been related to the handling of promises and asynchronous operations. (Some general information can be found in CesiumJS Ready Promise Deprecation / API Changes , but this is only indirectly related to your question).

Long story short:

  • createWorldImagery was replaced with createWorldImageryAsync
  • createWorldTerrain was replaced with createWorldTerrainAsync

And you have to use await to await the results of these functions:

const viewer = new Cesium.Viewer('cesiumContainer', {
  imageryProvider: await Cesium.createWorldImageryAsync(),
  terrainProvider: await Cesium.createWorldTerrainAsync(),
  scene3DOnly: true,
  selectionIndicator: false,
  //baseLayerPicker: false
});

(BTW: In most cases, one can just rely on the default imageryProvider and terrainProvider…)