Hi everyone,
While querying the CogniteAsset view, I encountered an error when including the activities field in the selection. The API returns the following message:
"Cannot traverse lists of direct relations inwards."
Upon investigating, I noticed that the activities field in the CogniteAsset view is defined as a @reverseDirectRelation:
activities: [CogniteActivity] @reverseDirectRelation(throughProperty: "assets")
In turn, the assets field in the CogniteActivity view is defined as a list of direct relations:
assets: [CogniteAsset] @directRelation
This makes sense as the root cause, since reverse traversal over a list of direct relations is not allowed, which explains the error.
Given that this field leads to an invalid query pattern and always results in an error, should the activities field be removed from the CogniteAsset view to avoid confusion and runtime errors?
Here’s a minimal query that reproduces the issue:
query MyQuery {
listCogniteAsset {
items {
aliases
activities {
items {
externalId
}
}
}
}
}
Thanks!
Check the
documentation
Ask the
Community
Take a look
at
Academy
Cognite
Status
Page
Contact
Cognite Support