Back
TypeError: n[0][n[1].key] is undefined -> Error when create a document w attribute t string array
- 0
- Self Hosted
- Databases
rbiut
I created a collection and then i added a attribute in this way:
$databases->createStringAttribute(dbid,'colid','variants',100,false,null,true);
required is false, default is null and array is true
then, i created a document in this way:
TypeScript
xxxyyyy,
'xxxxxyyyy',
Appwrite.ID.unique(),
{
variants: ['0']
},
);```
document is created, i can see it in console, however when i want to access to its data in console, it dont show anything and crash with this errors:
```Uncaught (in promise) TypeError: n[0][n[1].key] is undefined
Uncaught (in promise) Error: Timeout
Realtime got disconnected. Reconnect will be attempted in 1 seconds. <empty string>```
i cant then use console until i refresh the browser, if i go to collection i can see the document on the documents list but the variants columns only shows [ ]
if i try to add a document manually from console it add the document too but again, variants attribute shows empty and trying to access to the document data make it crash again
if i delete the attribute variants and try to create it again manually from console it creates the attribute but shows a label "fail" or "failed" when listing the attributes of the collection, i need to delete the database and create it again so i can add the attribute again from scratch..
is this a bug or i missing something? Im running 1.4.13 self hosted
TL;DR
Error occurs when creating a document with a string array attribute. Possible bug as data doesn't display and console crashes. Deleting and recreating attribute sometimes shows as failed.
Solution: Update to the latest version, as this may be a bug in version 1.4.13. Try creating the attribute again after the update to see if the issue persists. Steven
Can you see what the JSON is for the document? Maybe via the browsers network logs?
Recommended threads
- Seed db
hello there... is this correct way to seed appwrite
- Query Appwrite
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?
- 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...