I'm getting a "API Response Error: The Content-MD5 you specified is invalid for multi-part uploads.." error

I’m getting this error when trying to build the Standalone apps.

In a project I’m working on we have a problem with the Standalone apps: they take too long loading. I did a bit of research and found out that the assets are not bundled with the .apk nor the .ipa and that what the bootstrapping code does is actually download these assets into cache. This is a huge inconvenience because the people that’ll use the app will probably be on data which means downloading these assets will take even longer. So my solution was to convert these images into base64 strings, surely they’re heavy but at least they’ll be bundled with the app. Then I tried to build for android and got the error for the first time. I found this and checked that one of the images base64 was just a few bytes over 5MB (24kB to be precise), so I decided to rollback for that image, since it was the largest (3.8MB) one in the app and the only image on the Screen where I use it. But when building I still get the same error.

Things I’d also like to ask is why though the Android Standalone .apk is 23MB it takes up to about 80MB installed? Does this happen to for iOS too? I know the .ipa I get is about 130MB, but in the App Store the app is only 33MB because of App Thining.

That’s correct, we bundle your JS with the standalone app, but we don’t (yet) bundle assets on first load. That is a feature we hope to add when we have time. Converting some of your assets to base64 is a reasonable stopgap for now.

I’m not sure why the Upload error would occur when using base64, since it sounds like you aren’t uploading anything. Are you sure there isn’t another (non-base64) asset somewhere in your project which is over 5MB? (cc @nikki)

I think the Android app probably just contains a lot of archived code. @jesse is 80MB consistent with your expectations?

Edit: Actually what’s probably causing the error is that your JS bundle is now very large (because it contains those base64 assets). cc @ide on what we might do to address this.

Yeah I was thinking this too, in one of my screen I use several images.

It would be nice if an error like this did say what the problem may be eg. “Your bundle is too large” or “X asset is too large”.

For now my solution is going to be to balance between using base64 and image file. I’ll have to create a custom image container that shows a loading animation while the image is loading. I’ll leave the smaller images as base64 hoping these wont make the bundle too large.

Thank you for your response.

1 Like