Skip to content

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

@maperz

Description

@maperz

👟 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?

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingproduct / databasesFixes and upgrades for the Appwrite Database.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions