I have created a blog website in REACT. When I try to post, sometimes an error is shown.
try{
return await this.databases.createDocument(
conf.appwriteDatabaseId,
conf.appwriteCollectionId,
slug,
{
title,
content,
featuredImage,
status,
userId,
}
)
}
catch(error){
console.log("Appwrite serive :: createPost :: error", error);
}
}```
@Binyamin @Arman
@D5
Please, avoid pinging core members if it's not necessarily 😅
okay
Looks like userId is required, but you're not specifying it?
Also, do you can see the data being saved in the console at all? I think that it doesn't have a proper structure (Json-like)
It's not that it never happens, sometimes it gets posted
Hmm then maybe you're not specifying the user ID? Anyways, I recommend doing that in a function to prevent manipulation
How to specify the user ID
?
You have here an userId attribute
yup
i am so frustrated
It is not getting solved
see
use ID.unique
const newAccount = await account.create( ID.unique(), user.email, user.password, user.name );
like this
Recommended threads
- how to store array of objects as an attr...
department: [ { branch: "branchName", speciality: ["specialityName", "specialityName2"], }, ], storing this as an attribute
- Limit exceeded
status of 429 {"message":"The current user session could not be found.","code":404,"type":"user_session_not_found","version":"1.6.0"}
- Security Concern regarding the tutorial ...
In the tutorial we have: ```ts // src/lib/server/appwrite.js "use server"; import { Client, Account } from "node-appwrite"; import { cookies } from "next/head...