iTwin and createTilesetfromiModelId

Iven been experimenting with visualizing an iModel using a custom app (not Ion). And for a while it worked fine, until yesterday when the generated token appears to no longer be accepted in the iTwinData.createTilesetFromiModelId() call.
Did something change yesterday?

I now consistently get this error on the following line of code:
const mytiles = await ITwinData.createTilesetFromIModelId

“Uncaught (in promise) RangeError: Invalid array length
at new DynamicEnvironmentMapManager (chunk-K5RKBSQI.js?v=4ea5af89:85967:38)
at new Cesium3DTileset (chunk-K5RKBSQI.js?v=4ea5af89:126203:33)
at Cesium3DTileset.fromUrl (chunk-K5RKBSQI.js?v=4ea5af89:127131:19)
at async fetchToken”

Here is the code snippet:

    useEffect(() => {
        const fetchToken = async () => {
            const returnedData = await fetchGET('https://api.cesium.com/itwin/token');
            const { access_token: mytoken } = await returnedData;
            setToken(mytoken);
            console.log(`Latest token: ${mytoken}`);
            ITwinPlatform.defaultAccessToken = mytoken;
            const mytiles = await ITwinData.createTilesetFromIModelId('669dde67-eb69-4e0b-bcf2-f722eee94746');

            const myurl = mytiles?.resource?.url as string;
            setUrl(myurl);
        };

        fetchToken();
    }, []);

Hi @hilmar.retief!

Nothing should be changing with CesiumJS, unless the library version is updated.

We did release a new version of CesiumJS on Feb 3. Did you install the new version? For example, if you have installed it with npm, did you run npm install?

Thanks Gabby. I did update to the latest, and there was also an issue related to async updates in React, specifically I wanted to use TypeScript with useEffect. So, I still have a question on that, but for now if I set the initial state of the “url” to a known value.
The reason it complained about the empty array was because the token was sometimes null.