mozilla / addons-linter

🔍 Firefox Add-ons linter, written in JavaScript. 👁
Mozilla Public License 2.0
318 stars 144 forks source link

Firefox addon signin failed due to JSON file size #3680

Closed noorulhussain closed 2 years ago

noorulhussain commented 3 years ago

Describe the problem and steps to reproduce it:

Firefox addon signin got failed due to the following error. Error: This file is not binary and is too large to parse. Files larger than 4MB will not be parsed. Consider moving large lists of data out of JavaScript files and into JSON files, or splitting very large files into smaller ones.

What did you expect to happen?

The file size constaraint should not be applicable to JSON file.

Anything else we should know?

https://addons.mozilla.org/en-US/developers/upload/20353cf30bd0455eb449f243ee912c69 image

willdurand commented 3 years ago

@wagnerand the error message we show is indeed weird: we tell the developer to move data from JS to JSON when a JSON file is large. We should either fix the error message for JSON files or not check the file size of JSON files. WDYT? /cc @diox

wagnerand commented 3 years ago

I agree that the message is confusing. It should probably only be applied to files that contain code.

willdurand commented 3 years ago

It should probably only be applied to files that contain code.

@wagnerand sorry, "it" being? The error?

wagnerand commented 3 years ago

"It" meant to be the message, but more accurately it's the check that can lead to the message/error.

diox commented 3 years ago

We are parsing JSON files, so it makes sense to have a limit for them too, but it could probably be different, and much higher for them ?

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. If you think this bug should stay open, please comment on the issue with further details. Thank you for your contributions.

arpitest commented 2 years ago

i have the same issue. my extension has 2 big .json files included (word dictionaries), and it fails check when try to upload.

OlegWock commented 1 year ago

For fellas who might came here from Google. Workaround for this is to use different file extension, e.g. .jsonx works just fine. You still can load these files using fetch and parse them as JSON:

const url = browser.runtime.getURL(`/filename.jsonx`);
const resp = await fetch(url);
const json = await resp.json();
coppermight commented 1 year ago

can this be done or something similar to split a js file?