Skip to content

document.list() returns 500 error when filtering by instanceId #1270

Open
@shotainoguchi

Description

@shotainoguchi

Describe the bug
When calling document.list() and specifying instanceId as a filter, a 500 error is returned.

To Reproduce
Execute the following code:

client.documents.list({
  filter: {
    equals: {
      property: ["instanceId"],
      value: {
        externalId: "377471e4-c9cf-4a3b-9e35-49981c8b576a",
      },
    },
  },
  limit: 1000,
});

You will see an 500 error Internal server error. Please contact Cognite.

Expected behavior
I was able to get a valid response with this request:

client.post(
  `/api/v1/projects/${PROJECT}/documents/list`,
  {
    data: {
      filter: {
        equals: {
          property: ["instanceId"],
          value: {
            space: "File_Search",
            externalId: "377471e4-c9cf-4a3b-9e35-49981c8b576a",
          },
        },
      },
      limit: 1000,
    },
  }
);

In my humble opinion, we should create a new interface instead of Label interface for example:

export type CogniteExternalId = string;
export type CogniteSpace = string;
export interface Instance {
  externalId: CogniteExternalId;
  space: CogniteSpace;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions