
It works fine on the console, but the opposite happens with the client SDK. Here are my code snippets (Note that it does work if I remove the relationship) :
await ApiConst.databases.createDocument(
databaseId: ApiConst.databaseID,
collectionId: ApiConst.postsCollectionID,
documentId: ID.unique(),
data: {
'title': 'Lorem ipsum',
'body':
'Lorem ipsum is placeholder text commonly used in the graphic...',
'comments': '6456f4e874e9f5bbd504' // Relationship
},
);
Here the error :
AppwriteException (AppwriteException: general_unknown, Server Error (500))

What kind of relationship is the comments attribute?
Also, would you please look at the docker logs for the appwrite container and share the logs for the related 500 error

i have also noticed lot of known simple errors are shown as [general_unknown, Server Error (500)] . and i had to use appwrite log to debug the code. it would be great if that correct error is shown as specific error in the server response instead of general_unknown error.

We really shouldn't be showing 500. It might be good to create an issue for whichever 500 error you're seeing so we can update it to be more descriptive

in this channel or in git?

Its is " One to many "

That`s strange, it worked after adding the relationship ID into square brackets.
'comments': ['6456f4e874e9f5bbd504'] // Relationship
I`m confused because in another project, it worked fine without these square brackets.

it is because if you have attribute with relationship enable then it is required

its one to many
relationship, so you have to give an array of documents.. if it was one to one
or many to one
, then you can give a single item . i guess

Uh, I see. Thanks. By the way, have you ever encountered this issue when adding items to a 'one-way relationship' from the client SDK? It seems to override previous items.

GitHub
Recommended threads
- ❗[Help] Function stuck in "waiting" stat...
Hi Appwrite team 👋 I'm trying to contribute to Appwrite and followed the official setup instructions from the CONTRIBUTING.md guide to run the platform locall...
- Help with 409 Error on Relationship Setu...
I ran into a 409 document_already_exists issue. with AppWrite so I tried to debug. Here's what I've set up: Collection A has 3 attributes and a two-way 1-to-m...
- Database Double Requesting Error.
I am getting error for creating new document in an collection with new ID.unique() then too getting error of existing document. When button is pressed one docum...
