
As said above, Im trying to upload a json string to my database. However i get the following error:
Uncaught (in promise) AppwriteException: Invalid document structure: Attribute "JSONFile" has invalid type. Value must be a valid string and no longer than 9999 chars. Im pretty sure the issue is the filesize in this case. Now my question. What is the best workaround for this?

What size have you set on the Attribute?

Code that goes with this btw
export async function WriteSheetToDatabase(FileToSend) {
console.log(FileToSend)
//Make JSON string
const JsonData = JSON.stringify(FileToSend);
let SheetID = FileToSend.SheetID;
const userID = await userId;
if (!userID) {
console.error("Could not find active Session!");
return;
}
const fileObject = {
UserID: userID,
JSONFile: JsonData,
SheetID: SheetID,
};
//If there is already an existing version, overwrite new saveData
if (!SheetID) {
//make document with unique ID.
const Doc = await database.createDocument(
process.env.NEXT_PUBLIC_DATABASE_ID,
process.env.NEXT_PUBLIC_SHEET_COLLECTION_ID,
ID.unique(),
fileObject
);
fileObject.SheetID = Doc.$id;
FileToSend.SheetID = fileObject.SheetID;
fileObject.JSONFile = JSON.stringify(FileToSend);
console.log("Saved CharacterSheet");
//Grab doc and grab the $id which is uniqueID. add said ID to to FileToSend.SheetID;
if (fileObject.SheetID !== null) {
await database.updateDocument(
process.env.NEXT_PUBLIC_DATABASE_ID,
process.env.NEXT_PUBLIC_SHEET_COLLECTION_ID,
fileObject.SheetID,
fileObject
);
} else {
console.error("SheetID is null");
}
}
also this only happens when i try to console.log() the data out.

9999

And the string is shorter than that?

yes its: 9011

though I will go over that 9999 when i update the app further

so i need to find a way around it

I am self hosting so if anything needs to be changed i can do that
Recommended threads
- Unraid Deployment
Does anyone know how to point a production iOS app to an Appwrite Docker image I have on my Unraid server? I need a lot of storage, and having Appwrite on my Un...
- Can't create account in fresh self-hoste...
Clicking Sign Up shows this in the console: TypeError: undefined is not an object (evaluating 'W.validity')
- Best practices for Appwrite authenticati...
Hi Appwrite community, I’m building a React Native app and planning to use Appwrite for authentication. I have some questions about the architecture and securi...
