Bug with uploading "large" files in addon

When I try to upload my extension package I get the following error saying that “large” js files (over 4MB) are not supported and that data should be moved into .json files instead. However, as you can see from the below screenshot the file in question is a .json file so shouldn’t be causing an error.

Hi @qqzm, thanks for noting this. We can update the error message to be clearer, but you do need to find a way to reduce your extension’s file size to successfully complete the submission process. You may want to try offloading your json into different parts, or using a supported minification method.

Hi Caitlin
Thanks for your response.
I cannot reduce the size of the file, or split it up. It’s a single 8.5 MB data array in json format. There’s nothing minification would do to reduce it.
4MB is really nothing in this day and age, it seems an unreasonable limit to have. Is there really no chance it can be increased?
I note that the Chrome and Edge addon galleries have both accepted it without issue.

Sorry, 4MB is a hard limit at the moment. We have some plans to move our infrastructure services to a different platform in the next 18 months, and it’s possible we’ll be able to accept larger files when that happens.

Well, if it’s indeed an array, you could manually split it into 3 arrays each having <3 MB.

Or you could try to zip it and then unzip it at the runtime, there is one library optimized for speed that should do it in a fraction of a second:

Or you could load it from a server… but I think for that you would need some user approval.

Thanks for the helpful suggestions, juraj.
I tried zipping it and even on maximum compression it only got just under 4MB, so would only be a short term solution - the data is constantly growing so it’ll be back above 4MB soon enough.
I could split the array into 3 and then stitch it back together in code after loading the files. I have a couple of problems with this approach. Firstly it’ll load more slowly as 3 files and even once loaded it’s inefficient to concatenate them together so altogether will add an unacceptable delay on page load. Secondly I’ll have to submit the change to be reviewed for publication on the Chrome and Edge galleries and they may question or reject the change and I’ll have to explain that I’m somehow living in 2003.
But the third suggestion I think could work with some modifications. I can’t possibly have people load the extension before the data has downloaded as they’ll assume the extension doesn’t work, remove it and leave a 1 star review. However, what I could do is cut the data down to 4MB and distribute that, with a background process that kicks-off to download the complete file when it is first used. That way it’ll still work out of the box, even if only on 50% of cases, and as soon as the background download successfully completes it’ll work 100%.

Hi Caitlin,
It’s been 21 months, is there any possibility that the 4MB restriction can be lifted yet?
Thanks and best wishes,
Stephen

1 Like