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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Bug Report: TypeError when calling listDocuments using Query.select #6158

Open
2 tasks done
maperz opened this issue Sep 5, 2023 · 1 comment
Open
2 tasks done
Assignees
Labels
bug Something isn't working product / databases Fixes and upgrades for the Appwrite Database.

Comments

@maperz
Copy link

maperz commented Sep 5, 2023

馃憻 Reproduction steps

After recently upgrading Appwrite from 1.3.7 to 1.4.1 and running the migrations we experienced some issues with the Flutter SDK (v10.0.1) complaining about missing fields.

image

The only system fields sent by Appwrite and received by the SDK are "$databaseId", $collectionId".

The code to list the documents is the following:

 Future<List<Group>> _getGroupList() async {
    final groupDocuments = await _databases.listDocuments(
        databaseId: appwriteDatabaseId,
        collectionId: groupCollectionId,
        queries: [
          Query.orderDesc("\$createdAt"),
          Query.select(["groupName", "owner", "members", "description"])
        ]);

    return groupDocuments.documents
        .map((document) => Group.fromAppwriteDocument(document.data))
        .toList();
  }

As @stnguyen90 indicated on Discord, I tried to include the system attributes manually and that seems to fix the issue:

Query.select([
            "groupName",
            "owner",
            "members",
            "description",
            "$updatedAt",
            "$createdAt",
            "$id",
            "$permissions"
])

馃憤 Expected behavior

A call to listDocuments does not raise errors when using a Query.select without including system attributes.

馃憥 Actual Behavior

A TypeError is raised by the SDK indicating that system attributes received such as $permissions are Null, but are mandatory to construct the client document.

馃幉 Appwrite version

Version 1.4.x

馃捇 Operating system

Linux

馃П Your Environment

Appwrite 1.4.1 recently upgraded from 1.3.7.
Flutter Client using Appwrite Flutter SDK 10.0.1

馃憖 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?

@maperz maperz added the bug Something isn't working label Sep 5, 2023
@maperz maperz changed the title 馃悰 Bug Report: 馃悰 Bug Report: TypeError when calling listDocuments using Query.select Sep 5, 2023
@stnguyen90 stnguyen90 added the product / databases Fixes and upgrades for the Appwrite Database. label Sep 5, 2023
@stnguyen90
Copy link
Contributor

@maperz, thanks for raising this issue! 馃檹馃徏 We changed select to only return what you request rather than automatically including the system attributes as requested in #5376, but it looks like that causes problems in the SDK. I'll talk to the team about how to address this.

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