
Hey, new report of 500 errors related to relationships.
I have collection A with two one-way one-to-many relationship fields to collection B.
I loop over documents and delete them using databases.deleteDocument
.
- When both of the fields contain no document, I get a 500 error and this error:
[Error] Method: DELETE
[Error] URL: /v1/databases/:databaseId/collections/:collectionId/documents/:documentId
[Error] Type: PDOException
[Error] Message: There is already an active transaction
[Error] File: @swoole-src/library/core/Database/PDOProxy.php
[Error] Line: 43
- When one of the two fields is not empty (so it still has at least one relationship), I have this error:
[Error] Method: DELETE
[Error] URL: /v1/databases/:databaseId/collections/:collectionId/documents/:documentId
[Error] Type: Exception
[Error] Message: Unknown PDO Type for object
[Error] File: /usr/src/code/vendor/utopia-php/database/src/Database/Adapter/MariaDB.php
[Error] Line: 1347
I love Appwrite, but all these errors are ruining our 3 apps in production, so we have to stop using Appwrite for the next developments. These 3 apps are totally independent and all using 1.3.7. All have quite large amount of data (>50k documents with relationships) and traffic (100s of daily users).
Looking at other similar posts, it seems you've never replicated these kind of errors on your side, maybe we should organize to make sure it can be tracked? @Vedsaga suggested to create some sort of tracking for these relationship-related errors, I think it's a good idea.

If you have some development power available on your side, I can suggest you to create a demo project with real-life amount of data + activity using extensive relationship so you can identify the issues. Most of issues I have identified for now are happening on document update and deletion. Also one very annoying permission issue when using two collections with document-security enabled.


If you could send here and in the issue the related docker errors, could be really helpful

I recommend using sentry to log errors

Sure, which docker container?

How does it work with Appwrite?

Btw there is also a 500 error when updating only one field of a document without updating its relationships. For example:
{ '$id': 'abc', '$collectionId': 'a', 'profiles': [{ '$id': 'xyz', '$collectionId': 'b' }] }, 'name': 'John'}
databases.updateDocument('db', 'a', 'abc', { name: 'Hello' }) // throws a 500 error
databases.updateDocument('db', 'a', 'abc', { name: 'Hello', profiles: [{$id: 'xyz', ...}] }) // throws a 500 error
databases.updateDocument('db', 'a', 'abc', { name: 'Hello', profiles: ['xyz'] }) // doesn't throw error
It yields this 500 error:
[Error] Method: PATCH
[Error] URL: /v1/databases/:databaseId/collections/:collectionId/documents/:documentId
[Error] Type: Exception
[Error] Message: Invalid value for relationship
[Error] File: /usr/src/code/vendor/utopia-php/database/src/Database/Database.php
[Error] Line: 3099

You set the env var and then you get all errors from all containers and very detailed (more than the ones Appwrite gives you)

for tracking, a github issue per reproducible problem would be best. The most important part is we need to be able to reproduce it so that we can figure out what's wrong and fix it

Recommended threads
- Adding "name" column to table creates 2-...
As stated, im adding the "name" column to one table, it adds 4 duplicates. In another table it adds 3 duplicates, and when I delete 1 of them, all duplucates di...
- 2 Columns still processing since yesterd...
Hey o/ Yesterday (around <t:1758045600:f>), I created a database and added several columns to it. After about 15 minutes, most of the "processing" tags disappe...
- 503 Timeout when Updating or Upserting D...
Hey I’m running into an issue when trying to update or upsert a row in Appwrite. The request hangs for a while and then throws this error: ``` AppwriteException...
