Back

[SOLVED] Cannot read properties of undefined on appwrite cloud

  • 0
  • Cloud
ianmont
16 Sep, 2023, 07:39

I got this error on the console of appwrite cloud when clicking in a document

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'length')

And the document doesnt shows up, some times it goes full black screen or stays at loading and the error on the console shows up

TL;DR
The user was experiencing an issue with the "Cannot read properties of undefined" error on the Appwrite cloud. The issue has been solved. The solution involved deleting the corrupted document and recreating it. The user also encountered a problem with the page not loading properly and attributes not being displayed. It was suggested to check the network tab for the request related to the document and share the response body.
Drake
16 Sep, 2023, 14:58

Would you be able to check the network tab and look for the request for the document? Then share the response body

ianmont
16 Sep, 2023, 16:22

In the network tab there are many things but this is the only one that seems to look like the document that im trying to open

ianmont
16 Sep, 2023, 16:22

{ "$id": "6502750d3953de32412b", "$createdAt": "2023-09-14T02:50:53.235+00:00", "$updatedAt": "2023-09-14T02:52:08.294+00:00", "$permissions": [ "read(any)", "create(team:64fff91d8c3a37b75906)", "read(team:64fff91d8c3a37b75906)", "update(team:64fff91d8c3a37b75906)" ], "databaseId": "64de657768e3169c1b54", "name": "platformInfo", "enabled": true, "documentSecurity": true, "attributes": [ { "key": "whitelist", "type": "boolean", "status": "available", "required": false, "array": false, "default": null }, { "key": "topbarAlert", "type": "boolean", "status": "available", "required": false, "array": false, "default": null }, { "key": "topbarAlertMessage", "type": "string", "status": "available", "required": false, "array": false, "size": 999, "default": null }, { "key": "maintenance", "type": "boolean", "status": "available", "required": false, "array": false, "default": null }, { "key": "whitelistUsers", "type": "string", "status": "available", "required": false, "array": true, "size": 9999, "default": null } ], "indexes": [] }

ianmont
16 Sep, 2023, 16:24

and then there is this other one called document and the response is an html

Drake
16 Sep, 2023, 18:48

There should be a fetch/xhr request that ends in /documents/[document id]

ianmont
16 Sep, 2023, 20:06

There is none like /documents/id with the slash, but this one here is called document-65027544323edc9b8fd0

Am I looking for it the right way or im missing something?

Drake
16 Sep, 2023, 20:19

It only shows the document id rather than the full path so if you have to click on it to see the full URL.

Anyways, it should be the last or second to last request in that screenshot you shared

ianmont
16 Sep, 2023, 20:36

ohh i see, the last 2 ends on /documents/id.

here is the response, preview and headers tab:

Drake
16 Sep, 2023, 20:39

So the page doesn't load properly when you open this document? Are all the attributes there? Is that null one an array attribute?

ianmont
16 Sep, 2023, 20:46

Exactly, the page does not load when I open the document, it remains without displaying information. If I refresh everything stays black

The attributes page can be seen, the whitelistUsers does not seem to be in the fetch response could that be the error?

Drake
16 Sep, 2023, 20:48

Ya that'd be the problem. That's weird that happened. By default, arrays should be an empty string and never null or missing 🧐

Any idea how this happened?

ianmont
16 Sep, 2023, 20:49

Hmm weird, I have no idea how it could have happened. Should I try deleting the attribute and doing it again?

Drake
16 Sep, 2023, 20:54

You can recreate the document

ianmont
16 Sep, 2023, 20:57

Alright, how can I delete a document without entering the document view? Is it possible to do it by code? Or how do I access the view of the corrupted document so I can delete it?

Drake
16 Sep, 2023, 21:09

You can use a server SDK or Appwrite CLI

ianmont
16 Sep, 2023, 21:14

alright thank you very much steven i will try that

ianmont
16 Sep, 2023, 21:56

its fixed now <:appwriterocket:823996226894692403>

ianmont
16 Sep, 2023, 21:56

[SOLVED] Cannot read properties of undefined on appwrite cloud

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more