GroundPolylinePrimitive._initializeTerrainHeightsWorker fails when app is served via a proxied domain
See original GitHub issueGroundPolylinePrimitive._initializeTerrainHeightsWorker tries to load in the approximateTerrainHeights.json from a relative path.
GroundPolylinePrimitive.js
ApproximateTerrainHeights.initialize('../Assets/approximateTerrainHeights.json')
This then calls the buildModuleUrl function with that path before passing it to Resource.fetchJson
ApproximateTerrainHeights.js
ApproximateTerrainHeights._initPromise = Resource.fetchJson(buildModuleUrl(url)).then(function(json) {
ApproximateTerrainHeights._terrainHeights = json;
});
buildModuleUrl first does a check to see if it’s running in node by checking typeof document === 'undefined' and if true, it just returns moduleID.
When inside a web worker, document is undefined and the relative path is returned as it would be in node. This is fine when the code is being accessed on the same domain as it’s being served on.
But when you proxy the app, the relative path becomes http://proxied-url.com/../Assets/approximateTerrainHeights.json which doesn’t exist as the JSON is being served on a different domain and so the Resource.fetchJson blows up.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)

Top Related StackOverflow Question
Thanks for catching this before it went out in the release @madole! I’ve opened up a pull request fixing it here: #6715
Whoops, meant to comment on the PR not the issue.