question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GroundPolylinePrimitive._initializeTerrainHeightsWorker fails when app is served via a proxied domain

See original GitHub issue

GroundPolylinePrimitive._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:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
hpinkoscommented, Jun 21, 2018

Thanks for catching this before it went out in the release @madole! I’ve opened up a pull request fixing it here: #6715

0reactions
mramatocommented, Jun 28, 2018

Whoops, meant to comment on the PR not the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found