CesiumTerrainProvider: Failed to obtain terrain tile

I have an issue in my CesiumJS website where sometimes Cesium works and sometimes it doesn’t. Sometimes the globe appears and my app works, in other times it appears I’m stuck in outer space the globe never appears. When I’m stuck in outer space, I get this message:

Non-standard status.
An error occurred in “CesiumTerrainProvider”: Failed to obtain terrain tile X: 2 Y: 0 Level: 2

Closing the browser and re-opening always fixes it, but after opening a few tabs of my site, the error appears. Refreshing the page doesn’t fix it; only closing all open browser windows does. Any idea why I can’t always access the tiles?

Hi there! Welcome to the Cesium Community.

A couple of our users have had this issue in the past. I recommend checking out the following resources:

Which browser are you working with? Do you have the same error when using other browsers?

Please follow up if the above resources didn’t resolve your issue.

I’m using Chrome and Edge. The issue still persists. It’s as if my network has issues downloading layer.json sometimes, but not always. Can you think of any reason why closing/re-opening all browser windows would fix the issue with downloading layer.json?

The error I’m seeing in my Developer Console when I’m stuck in outer space is this:

The origin ‘MY_URL’ did not find ‘MY_URL’ in the Access-Control-Allow-Origin response
header for cross-origin resource at ‘https://api.cesium.com/v1/assets/1/endpoint?access_token=MY_KEY’.

Of note, I am using the default CesiumTerrainProvider.

Have you tried using a different network? Can you recreate the issue in a Sandcastle?