Hot Code Push fails because of "Error downloading asset" in cordova-plugin-meteor-webapp

I’ve noticed for a long time that Hot Code Push works unreliably in our production app. It only works about half of the time. Reproducing on Android, when Hot Code Push fails, it is always with the below error.

Meteor 1.10.2, cordova-plugin-meteor-webapp 1.9.1.

As far as I can tell the error is thrown in

Does anyone have insight into what might cause this?

Error: Error downloading asset: /__cordova/packages/templating-compiler.js
  at http://localhost:12472/plugins/cordova-plugin-meteor-webapp/www/webapp-local-server.js:51:21
  at Object.callbackFromNative (http://localhost:12472/cordova.js:287:58)
  at <anonymous>:1:9

The filename behind /__cordova/packages/ varies each time - dynamic-import.js, es5-shim.js, things like


The above logs were from the staging app; in production the errors are slightly different. Instead of Error downloading asset: /__cordova/packages/templating-compiler.js, I’ve seen each of the following:

  • Error: Error downloading asset: /
  • Error: timeout
  • Error: Error downloading asset: /videos/chat-video.mp4
  • Error: Error downloading asset: /__cordova/videos/chat-video.mp4
  • Error: Error downloading asset manifest
  • Error: Error downloading asset: /__cordova/2b1fae32d…bed2.js
  • Error: Error downloading asset: /__cordova/2b1fae32d…bed2.stats.json

I ended up moving the files from one subfolder in my public folder to S3, halving the size of public. It seems this solved it 100%.

I’m guessing cordova-plugin-meteor-webapp was more or less consistently failing to download the largest file, but for some reason ended up reporting errors on other files.