Back

500 error when updating document

  • 0
  • Databases
  • Web
  • Cloud
Ajmal Jalal
22 Mar, 2024, 01:02

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:

TypeScript
    "message": "Server Error",
    "code": 500,
    "type": "general_unknown",
    "version": "0.12.125"
}```
any thoughts?
TL;DR
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
22 Mar, 2024, 01:06

please make sure to:

  1. put descriptive titles so that it helps with searching and when looking at the list of posts
  2. format multiline code with backticks
  3. include all relevant tags
Steven
22 Mar, 2024, 01:06

would you please provide your project id?

Steven
22 Mar, 2024, 01:06

500 error when updating document

Steven
22 Mar, 2024, 01:12

there's some invalid value in one of your relationship attributes

Ajmal Jalal
22 Mar, 2024, 01:16

is there a way to see the logs or to find out which attribute it is?

Steven
22 Mar, 2024, 01:23

one of these:

TypeScript
$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
22 Mar, 2024, 01:23

what's your payload?

Ajmal Jalal
22 Mar, 2024, 01:29

here is the update func:

TypeScript
      process.env.NEXT_PUBLIC_APPWRITE_DATABASE_ID,
      collections.posts,
      postId,
      {
        likes: newLiks
      }
 );```
Ajmal Jalal
22 Mar, 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?

Steven
22 Mar, 2024, 01:47

Sorry I don't understand

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more