Skip to content

GraphQL Pagination Query cursors not working #1879

Description

@SociallyIneptWeeb

Description

When making a pagination query, the nodes returned all have the same cursor instead of having unique cursors for each node.

Environment

The graphql playground for demo.opencti.io
https://demo.opencti.io/graphql

Reproducible Steps

Steps to create the smallest reproducible scenario:
Run:

query SimpleStixObjectOrStixRelationshipStixCoreRelationshipsLinesPaginationQuery(
  $elementId: String! = "4e5aaa0a-ed0d-4011-bfa6-6c47bf703845"
  $relationship_type: [String] = "stix-core-relationship"
  $orderBy: StixCoreRelationshipsOrdering = confidence
  $orderMode: OrderingMode = desc
  $count: Int! = 8
  $cursor: ID
  $filters: [StixCoreRelationshipsFiltering]
  
) {
  ...SimpleStixObjectOrStixRelationshipStixCoreRelationshipsLines_data_3Yedex
}

fragment SimpleStixObjectOrStixRelationshipStixCoreRelationshipLine_node on StixCoreRelationship {
  id
  relationship_type
  from {
    ... on StixDomainObject {
      id
      entity_type
      parent_types
      created_at
      updated_at
    }
  }
  to {
    ... on StixDomainObject {
      id
      entity_type
      parent_types
      created_at
      updated_at
    }
  }
}

fragment SimpleStixObjectOrStixRelationshipStixCoreRelationshipsLines_data_3Yedex on Query {
  stixCoreRelationships(
    elementId: $elementId
    relationship_type: $relationship_type
    orderBy: $orderBy
    orderMode: $orderMode
    first: $count
    after: $cursor
    filters: $filters
  ) {
    edges {
      node {
        ...SimpleStixObjectOrStixRelationshipStixCoreRelationshipLine_node
        id
        __typename
      }
      cursor
    }
    pageInfo {
      endCursor
      globalCount
    }
  }
}

Expected Output

Every Node should have its own unique cursor value.

Actual Output

Every node has the same value. For other element IDs, there is the possibility that some nodes have different cursors but most are still the same cursor value.

Screenshots

Actual output with all nodes having the same cursor value
Capture

Metadata

Metadata

Labels

bugType: something isn't working (fix:).solvedResolved (should be linked to the solving PR).

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions