Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug Report: new empty collections reported as not found by databases.listDocuments() #5687

Closed
2 tasks done
melnibon opened this issue Jun 12, 2023 · 2 comments
Closed
2 tasks done
Assignees
Labels
bug Something isn't working product / databases Fixes and upgrades for the Appwrite Database.

Comments

@melnibon
Copy link

👟 Reproduction steps

  1. Create a new (empty) collection in the AppWrite web console
  2. In Flutter app, after login, call Databases(client).listDocuments(databaseId: "[dbID]", collectionId: "[collID]"
  3. This call throws an exception:
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: AppwriteException: collection_not_found, Collection with the requested ID could not be found. (404)
#0      ClientMixin.prepareResponse
#1      ClientIO.call
<asynchronous suspension>
#2      Databases.listDocuments
<asynchronous suspension>
#3      _MyHomePageState.loadItems
<asynchronous suspension>
#4      _MyHomePageState._initAppWrite
<asynchronous suspension>
Restarted application in 308ms.

👍 Expected behavior

  • Databases(client).listDocuments() should return an empty List.
  • The server should not return a 404 code.

I think the origin of the bug is the answer of the server. I suspect that the underlying table associated to the collection is not created in the same time than the collection, because it is also empty of attributes, but the low level table is not created even if I add attributes.

I suppose that because, after creating attributes, then adding documents in this collection, then deleting all of them, the collection is now listed by listDocuments() as empty without any exception.

So, to me, creating documents allows to create the collection (the low level SQL table), and brand new collections do not yet really exist, even if I add attributes to them (maybe this is the reason, adding attributes do not create/update the SQL table). The server should not answer 404 in such a case, but 200 and no data.

👎 Actual Behavior

  • Databases(client).listDocuments actually throws an AppwriteException: collection_not_found
  • The server returns a 404.

🎲 Appwrite version

Version 1.3.x

💻 Operating system

Linux

🧱 Your Environment

"out of the box" self-hosted AppWrite install

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

@melnibon melnibon added the bug Something isn't working label Jun 12, 2023
@joeyouss
Copy link

Hi
Can you please make sure you have the correct permissions assigned?

@joeyouss joeyouss self-assigned this Jun 15, 2023
@joeyouss joeyouss added the product / databases Fixes and upgrades for the Appwrite Database. label Jun 15, 2023
@melnibon
Copy link
Author

Oh, my ... !

You are right, I forgot to edit the permissions to the collection.
(first, I believed it related to the permissions inside the docker containers).

Many thanks,
Best regards,
Pierre

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working product / databases Fixes and upgrades for the Appwrite Database.
Projects
None yet
Development

No branches or pull requests

2 participants