
I'm getting 500 error on creating document with relationship

What do the docker logs for the appwrite container say for the 500 error?
Also, what's your code?

await database.createDocument(
databaseId: [DB ID],
collectionId: [Collection ID],
documentId: ID.unique(),
data: {
"user_id": userId,
"product_id": [productId],
"quantity": 1,
},
);

code

docker log


It's a little hard to read because its cut off but it looks like a permission problem. Does the user have update access to the related document?

Looks like it doesn't has update permission

i have updated the permission

but it showed this

What are the permissions on product and does product have any other related documents?

i haven't added permission on the products to create for this user but only for carts

The user needs access to every related document

to create carts, i'll need to add create access on my products table as well?

If the user is creating a document in that collection, then yes

I'm creating document on carts table not on products

and i have create access on carts

Ok so?
Recommended threads
- JSON and Object Support in Collection do...
I am working with Next.Js and Appwrite Cloud, I am relatively New to Appwrite but i have noticed there is no direct support of JSON and Object support in attrib...
- list() is very slow; eventually shows no...
When I use the web browser to view the collections in my database, the documents they contain are normally displayed within a few seconds. For a few days now, h...
- CSV Not Importing
We don’t seem to having any luck importing a simple .csv file. The import function acts like it’s working but no data imports or is shown in the collection The...
