
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
- Realtime Disconnects and Error: INVALID_...
Hi Support, we are still experiencing the issue and we are a subscriber on your platform under the account of charlesbcalague@gmail.com I just want to ask here...
- Collection Permission issue
I am facing issue in my Pro account. "Add" button is disabled while adding permission in DB collection settings.
- Opened my website after long time and Ba...
I built a website around a year back and and used appwrite for making the backend. At that time the website was working fine but now when i open it the images a...
