Old CesiumJS codes no longer work with the new version 1.103

I wanted to update resident CesiumJS on my web server to the new version 1.103.
Codes that worked for several years and several versions of CesiumJS before and until at least 1.85, does not work anymore. I had to go back to version 1.85 on my server that I had archived. It seems that all my codes with more than 2 input fields are blocking the script.

Example with tiled model:

Do you have any idea what can happen ? Should I create a issue on github ?

best regards,

version 1.99 does not work either

I made tests by downloading the old versions. The code still works with 1.91 but not with 1.92.

v1.92: Cesium Releases in April 2022 – Cesium

This might be related to the changes in the promises that is described in more detail at CesiumJS is switching from when.js to native promises-- Which will be a breaking change in 1.92 .

Could you describe in more detail what it means when you say that the code “does not work anymore”? Do you see rendering artifacts, or nothing rendered at all? Or do you see crashes or error messages in the console (if so: which messages) …? Maybe the CesiumJS core team can give more specific hints based on that, beyond the things that are mentioned in the linked thread.

Hello Marco13, In fact, my web page loads but remains blocked on the vision of the Earth globe and does not fly any more towards the tiled model which on the ground of the excavation site. In v 1.91 the FlyTo it still works but in v 1.92 my CesiumJS script doesn’t work like before.

When looking at your page in Chrome or Firefox, you can press F12 to open the ‘Developer Tools’ window. There should be a ‘Console’ at the bottom, which may contain an error message (in doubt, you may reload the page and see whether there is any message). If this does not bring any insights, it may be helpful if you showed the code that you are actually using to display your model.

excuse me Marco13, I thought you could run it in the old versions. Here is a capture of the console:

Cesium.js:894 options.url was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use CesiumTerrainProvider.fromIonAssetId or CesiumTerrainProvider.fromUrl instead.
Zv @ Cesium.js:894
Cesium.js:894 Cesium3DTileset constructor parameter options.url was deprecated in CesiumJS 1.104. It will be removed in 1.107. Use Cesium3DTileset.fromUrl instead.
Zv @ Cesium.js:894
Cesium.js:894 Cesium3DTileset.readyPromise was deprecated in CesiumJS 1.104. It will be removed in 1.107. Use Cesium3DTileset.fromUrl instead.
Zv @ Cesium.js:894
OppidumCorentRempartsOuest-ZoneFer20210906-07_ZoneBronze20210908-09.html:238 Uncaught TypeError: tileset_zoneB.readyPromise.then(…).otherwise is not a function
at OppidumCorentRempartsOuest-ZoneFer20210906-07_ZoneBronze20210908-09.html:238:4
about:blank:1 Blocked script execution in ‘about:blank’ because the document’s frame is sandboxed and the ‘allow-scripts’ permission is not set.

The critical part appears to be

TypeError: tileset_zoneB.readyPromise.then(…).otherwise is not a function

This corresponds to the instructions that are given in the linked thread, which says

In promise chains which originate from the Cesium API, switch to using the Promise API

  • otherwise changes to catch
  • always changes to finally

As a first, quick shot, you could look at your source code and search for the function otherwise, and change this to catch.

(Maybe that’s not the only difference, but it should bring you one step closer towards a state that works with the latest version)

1 Like

Hi Marco13,
I replaced all occurrences of “otherwise” by “catch” and everything works as before with the latest version 1.104. Thank you very much for your expertise. I had not seen this advice.
best regards, David.

Good to hear that.

You might want to have a look at the other warnings, though. There are some ongoing changes regarding the options.url and the readyPromise that will be removed in Cesium 1.107. There is a detailed description of the changes in CesiumJS Ready Promise Deprecation / API Changes . It’s hard to say where and how exactly that will affect your code, but you might want to keep an eye on that.

Thanks, Marco13. I will follow these changes in the APIs.

Whil I’ll take the opportunity to ask you if you have an example of sandcode to display a 3D tiled model object in space (like spaceship), with a stars background with CesiumJS ? and to be able to rotate around this object without the display of the earth glode ?

best regards, David.

Here is an example with a function that adjusts the height of a tileset (if this was what the question was about), and a function with a workaround to hide the globe (if this is what the question was about).

Note that hiding the globe like this is a workaround - it should be possible to just create the viewer with the globe: false setting. But that is currently causing some issues. (Maybe someone has a better solution…)

it’s good for the noglobe Earth, but I would like to turn completely around, to pass underneath (what we can’t in this sandcastle example). My model is not a ground tiled but a space probe starship object for example ISS in 3D tiled…

Then it might be better to ask this in a dedicated thread (with a proper title and goal description), so that more people (particularly the CesiumJS core team) can see it. There are some options for modifying the camera controls. In doubt, you have the complete freedom to implement your own, only using the Camera, as shown in the “Camera Tutorial” Cesium Sandcastle . But maybe there is already a predefined, simpler way to achieve your goal.