App crashes during HTML5 bundle load - "Unexpected Data Size" (SOLVED)

App works fine when I “Build” or “Build HTML5” locally, but when I bundle a HTML5 Application it fails.

I use Project -> Bundle -> HTML5 Application on my workstation (Windows), then upload it to my webserver (Slackware).

It shows the splash, then crashes with this message in JS console.

uncaught exception: Unexpected data size

I toggled a breakpoint on the line throwing the Unexpected data size exception (line 239 dmloader.js) and checked the objects being checked. The following are JS variables printed out from my browser.

if (actualSize != target.size) {
     throw "Unexpected data size";
}

target = Object { 
name: "game.projectc", 
size: 2798, 
pieces: (1) { data: Uint8Array(2838) [ 91, 112, 114, … ],
    dataLength: 2838,
    name: "game.projectc0",
    offset: 0 },
lastRequestedPiece: 0, 
data: Uint8Array(2838), 
totalLoadedPieces: 1 
}

actualSize = 2838

Given my actualSize and target.size don’t match, we get a this exception and we can’t load the app.

Any ideas how this can happen? I’m only using defsave module, the app is very simple. I have tried fixing my line breaks and it didn’t change the error. The whole HTML5 bundle is about 15MB.

If I change the “size” attribute in archive_files.json to match the “actualSize” reported by JS the app loads fine.

Are you using git? Check that you have line ending corrections setup.

4 Likes

Thank you so much @Pkeod for posting about this fix. I’ve had this HTML5 loading issue for a while, but it’s up and running now. :slight_smile:

2 Likes