Intermittent Infinite Loading of Assets from Ion in Cesium

Hello, good afternoon. I have an error that does not always occur, and I’m not sure if it is due to a mistake on our part or a limitation of the free version of Cesium.

I use Nuxt3, and I have this code to initiate the viewer and load assets from Ion:

let viewer = null;
let terrainProvider = null;
const accessToken = 'Token value';
onMounted(async () => {
    await loadViewer();
});

const loadViewer = async () => {
    try {
        Cesium.Ion.defaultAccessToken = accessToken;

        terrainProvider = await Cesium.CesiumTerrainProvider.fromIonAssetId('id asset terrain', {
            requestVertexNormals: false,
        });

        viewer = new Cesium.Viewer(cesiumContainer.value, {
            terrainProvider: terrainProvider,
            homeButton: false,
            geocoder: false,
            baseLayerPicker: false,
            animation: false,
            timeline: false,
            infoBox: false,
        });
        
        const imageryProvider = await Cesium.IonImageryProvider.fromAssetId('id assets imagery');
        const cesiumImagery = new Cesium.ImageryLayer(imageryProvider);
        viewer.imageryLayers.add(cesiumImagery);

        const resource = await Cesium.IonResource.fromAssetId('id assets geojson');
        const dataSource = await Cesium.GeoJsonDataSource.load(resource);
        await viewer.dataSources.add(dataSource);

    } catch (error) {
        console.log(error);
    }
}

Everything worked quite well for me, but many times when zooming in from outside the map to the assets very quickly, Cesium hangs, and the browser’s status bar remains on “waiting for assets.ion…etc”. If I go to the network tab in the developer tools, I see that there are assets or files that are part of the assets in pending, and it stays like that indefinitely. They do not load.

Other times I use in a button:

await viewer.flyTo(cesiumImagery, {
    offset: new Cesium.HeadingPitchRange(0, Cesium.Math.toRadians(-90), 6500)
});

and as it flies quickly to where the asset is, sometimes Cesium hangs in the same way.

Please, if you can guide me. Am I doing something wrong? Or is it some limitation of Cesium Community for free?

Thank you in advance for your attention.

Hi,

Cesium does not lower the streaming quality of service based on the plan level. You just get a lower total amount of data you can stream per month at the community level compared to at the commercial or premium level.

Here are some steps to take that can help troubleshoot the issue:

  • Are there any errors in the console when this happens?
  • Does this happen with any asset, or only a single asset? If so, what are is the type of asset and asset id?
  • Are you able to reproduce this on different networks (for example: home/office connection, 5G, internet cafe), or does it only occur using a single network?
  • Are you able to create a Sandcastle that reproduces the issue? That will eliminate your application code as the possible cause and make it easier for our team to reproduce the issue.

Hello. Thank you for your response.

There is no error displayed. The console doesn’t show anything. It just hangs when I zoom in too quickly or fly towards an asset. Then it gets stuck in “pending” waiting for asset files. The only solution is to close the browser tab and reopen the web to continue browsing.

The error doesn’t always happen, it’s random. I copied my code into Sandcastle and during the time I tested it, which was about 50 re-runs, it happened twice.

Is there a possibility to send the Sandcastle link via direct message? I cannot display the results of the assets here.

You can click the Share button at the top of the sandcastle page to get a link you can share. You can send that link to support@cesium.com with a reference to this thread if you do not want to post it publicly.