Server Error 500 if invalid data argument passed for Creating Child Doc in Relationship
- 1
- Self Hosted
- Databases
I am self hosted verison, 1.3.7.
Document Structure,
Level 1
- Level 2
Level 2 contain many Level 1 doc
Now, while creating Level 2 document if you pass list of Level 1 doc and for testing purpose, if you pass wrong data type for any of the artibute for example let's say Level 1 doc have attribute phone-number -> as interger and if you pass phoneNumber attrubute key as String "12345" . It return error 500 in the response in the clinet side.
Instead it should return normal 4xx error.
I have the same issue on 2 projects and it's very annoying. To clarify, my issue is that I can create a doc with invalid attribute (for example, a string longer than its attribute size), but then it breaks everything when appended to another doc as a relation. It should be impossible to create a document with a wrong attribute in the first place.
Could you please then create a GitHub issue describing the problem? If you add screenshots, etc it would be really useful to make it easier for maintainers finding and solving the issue 😄
Unfortunately this error seems quite inconsistant and is not appearing everytime. I think it could be very good for the core team to create a demo internal project involving a lot of relationhips, there are a lot of unhandled 500 happening randomly while deleting or updating documents. A strange bug that also happened to me today is that I needed to update all relationship fields when updating a single string field, otherwise it yielded a 500 error. Lots of small random errors that are very hard to reproduce.
There is also this error involving relationships: https://discord.com/channels/564160730845151244/1125081645322604554/1125081645322604554
A pattern I noticed in these errors is that they tend to happen once the project starts getting big. Playing with only a few level of relationship and a few documents is generally fine. Once the database starts getting bigger these random 500 starts to happen.
the core team to create a demo internal project involving a lot of relationhips
I second this, this will people help contribute and tend to slowly cover all edge cases one by one...
have even posted in the idea section long back
appwrite | [Error] Timestamp: 2023-07-18T17:21:29+00:00
appwrite | [Error] Method: POST
appwrite | [Error] URL: /v1/databases/:databaseId/collections/:collectionId/documents
appwrite | [Error] Type: PDOException
appwrite | [Error] Message: Out of range value for column 'phoneNumber' at row 1
appwrite | [Error] File: @swoole-src/library/core/Database/PDOStatementProxy.php
appwrite | [Error] Line: 64
this was long for the error that return 500
I tried to re-produce this error on 1.4.x and I get 400 Errors, Here https://github.com/appwrite/appwrite/issues/5851 Actually the '12345' was insert to age integer field