I am updating a doc using the SDK and the appwrite console, updating one of the doc is working just fine but another one fails with the following error:
Plain text
"message": "Server Error",
"code": 500,
"type": "general_unknown",
"version": "0.12.125"
}```
any thoughts?
Summary
Developers encountered a 500 error when updating a document. By renaming the relationship attribute to match the related collection, the problem was solved. The code snippet for updating the document was provided, along with part of the payload. There was a mention of an issue in one of the relationship attributes causing the error. A request for the project id was made to further investigate. Logs were suggested for troubleshooting.
Steven
Mar 22, 2024, 01:06
please make sure to:
put descriptive titles so that it helps with searching and when looking at the list of posts
format multiline code with backticks
include all relevant tags
Steven
Mar 22, 2024, 01:06
would you please provide your project id?
Steven
Mar 22, 2024, 01:06
500 error when updating document
Steven
Mar 22, 2024, 01:12
there's some invalid value in one of your relationship attributes
Ajmal Jalal
Web Developer
Mar 22, 2024, 01:16
is there a way to see the logs or to find out which attribute it is?
Steven
Mar 22, 2024, 01:23
one of these:
$createdAt: 2024-03-21 04:40:29.824,
$id: 65fbba3dc85bb7284ceb,
$permissions: [],
$updatedAt: 2024-03-21 04:40:29.824,
author: [Filtered],
content: This is my second post,
likes: 0,
masjid: ,
parent: null,
related_masjid: [],
replies: 0,
tags: []
I can't tell much more than that
Steven
Mar 22, 2024, 01:23
what's your payload?
Ajmal Jalal
Web Developer
Mar 22, 2024, 01:29
here is the update func:
Plain text
process.env.NEXT_PUBLIC_APPWRITE_DATABASE_ID,
collections.posts,
postId,
{
likes: newLiks
}
);```
Ajmal Jalal
Web Developer
Mar 22, 2024, 01:40
I removed the relationships and added it again and it solve the problem. the author attribute had a relationship with the user collection, changing it from author to user (same name as the related collection) fixed it. Does this mean that the relationship attribute should be name exactly the same as the related collection?