IDBStorageEnabled throws invalid url error

erm, not sure how to repro this on PG.
IDBStorageEnabled = true throws errors. I’m getting in ffox:

Uncaught TypeError: URL constructor: mydir/myfile.babylon is not a valid URL.

and in chrome:

Uncaught TypeError: Failed to construct 'URL': Invalid URL
    at n (babylon.js:16)
    at e._checkManifestFile (babylon.js:16)
    at new e (babylon.js:16)
    at Function.Pe.a.OfflineProviderFactory (babylon.js:16)
    at Function.e._LoadData (babylon.js:16)
    at Function.e.ImportMesh (babylon.js:16)
    at t.runTask (babylon.js:16)
    at (babylon.js:16)
    at e._runTask (babylon.js:16)
    at e.load (babylon.js:16)

I have a myfile.babylon.manifest in mydir. If I switch off IDBStorageEnabled, the error goes away. I presume there is some recent work on databases. Kindly advise what changes I should make on my end ?

Hi, did you recently upgrade to a new version of babylon? or are you using the preview cdn version?

Could you share the code? the URL parser was just recently changed, will be great to catch all of those errors and fix them asap

console shows: Babylon.js v5.0.0-alpha.19 - WebGL2

The line that triggers the error in my code is:

let tierAssetLoadMeshTask = tierAssetsManager.addMeshTask("tierAssetLoadMeshTask", basic_assets, "mydir/","myfile.babylon");

When I changed it to:
let tierAssetLoadMeshTask = tierAssetsManager.addMeshTask("tierAssetLoadMeshTask", basic_assets, "http://mydir/","myfile.babylon");

The invalid url error goes away to be replaced by cross-origin error which is as expected. I’m guessing your url parser needs the http protocol and does not deal with urls on local network?

1 Like

I guess the interesting part of it all is the fact that this function doesn’t return a valid URL with schema:

private static _ReturnFullUrlLocation = (url: string): string => {
        if (url.indexOf("http:/") === -1 && url.indexOf("https:/") === -1 && typeof window !== "undefined") {
            return (Database._ParseURL(window.location.href) + url);
        else {
            return url;

I am fixing it now (falling back if there is an exception), but have a few more questions :slight_smile:

The first one would be - how do you host this? is it a localhost server, or using files on your harddrive?
if it is a webserver, what does window.location.href return?


My development is on localhost (nodeJS), files are all on my harddrive atm. Will eventually move to webserver, but not now.

but you are not using the file:// protocol, right?

Nope. Not using file:// protocol

Just chked, console logs http://localhost:1001/, 1001 is my current arbitrary dev port.

odd, it should work out of the box. I’ll try reproducing it locally. In the meantime, this PR will solve this - defensive URL parsing by RaananW · Pull Request #10312 · BabylonJS/Babylon.js (

1 Like

Fix works, tyvm !

1 Like