[SOLVED] Can't create a new Document , Giving error as 'Value must be a valid JSON string'
- 1
- Databases
- General
- Web

still no luck!

You didn't set database ?


I created this db!

So you need to set ID here

yes I did

e.preventDefault();
const promise = await databases.createDocument(
"6471bb9750ced865202e",
"6471bbb56256066bc8e1",
uuidv4(),
{
todo,
}
);
console.log(promise);
promise.then(
function (response) {
console.log(response);
},
function (error) {
console.log(error);
}
);
//window.location.reload() // handle it in different way
e.target.reset();
// window.location.reload();
};

Check your code cause somethings wrong with the url called. There should be no undefined here

is my config file correct?

I didn't find anything wrong in my code!

User is logging in and out to the system

only Database has issue

This code is same as the documentation

Isn't your code crash after ? You use await AND .then on promise already resolved

For now I've no idea, just know that you need to fix "undefined"

I am new to appwrite. so I dont understand why this behaves like this

Someone else will answer you later 🙂 Keep focus

Hey

I fixed the issue

<:appwritebow:824077772192088064>

Basically We need to pass the database_id in when we call database
like this const databases = new Databases(client, "DB_ID")

"COLLECTION_ID",
uuidv4(),
{
todo,
}
);```

This is the modified code to create a document, same is applicable for all CRUD operations

Great that you find a solution. Don't forget to add [SOLVED] at begin of your post title

[SOLVED] Can't create a new Document , Giving error as 'Value must be a valid JSON string'
Recommended threads
- Subdomain failed verification
So I wanted to do a custom subdomain, because local storage doesn't work for me, but I've tried it a long time ago, it didn't work for me, and now I'm trying ag...
- Query params are way too limiting in ter...
I was trying to list rows in a table that do not already exist in another table. I retrieved around 260 row IDs which are 13 characters in length each, and then...
- [Node.js SDK] Bypass 2GB file limit?
Hello. Using either InputFile.fromPath or InputFile.fromBuffer throws this error: File size (2295467305) is greater than 2 GiB Bucket limit etc. is setup corre...
