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
- Type Mismatch in AppwriteException
There is a discrepancy in the TypeScript type definitions for AppwriteException. The response property is defined as a string in the type definitions, but in pr...
- What Query's are valid for GetDocument?
Documentation shows that Queries are valid here, but doesn't explain which queries are valid. At first I presumed this to be a bug, but before creating a githu...
- Appwrite exception: user_unauthorized, t...
After refreshing the app it is working perfectly