-
-
Notifications
You must be signed in to change notification settings - Fork 695
RangeError: Invalid string length for JSON.stringify #947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The error is thrown at the part below, where Nuxt Content generates a hash based on data of database: content/packages/content/lib/index.js Line 177 in 0b6a7be
According to the page about String length in MDN:
Nuxt Content is actually run in Node.js environment, but there would be same kind of limitation. If Nuxt Content v2 has same implementation, you might want to reconsider the way to generate hash. |
@nozomuikuta is it correct that this hash is only used for decorating/naming/fetching the db? So, there should be an easy fix, no? Maybe not the entire database.items._data as a String, especially if we only use the first 8 chars of that hash? What is the reasoning behind that? @atinux @pi0 |
So I changed the hash string to this: However, I now hit another String limit of similar nature, and this time I guess it is lokiDB problem whilst serializing the database, I assume ... content/packages/content/lib/index.js Line 193 in 0b6a7be
content/packages/content/lib/index.js Line 194 in 0b6a7be
|
Version
@nuxt/content: 1.11.1
nuxt: 2.15.7
Steps to reproduce
Generating or building a nuxt project with more than 12,000 json files in /content fails with error:
JSON.stringify
FATAL: RangeError: Invalid string lenght
Image to error here:
https://discord.com/channels/473401852243869706/476088961010499605/875018331764174888
What is Expected?
I guess that it generates successfully
What is actually happening?
I am assuming that there are to many data files that get bundled into one loki db.json file and it hits a natural string boundry for a json file? Currently with half my content/*.json files included this db-.json file is 500MB large, and it generates fine, however with all of the included I run into this error.
If my assumption is correct, can lokidb be split up into several db files, avoiding this error? How can we handle "large" amounts of data? Can lokidb spit out binary instead of json?
The text was updated successfully, but these errors were encountered: