server icon indicating copy to clipboard operation
server copied to clipboard

BUG: Querying storageAggregator data, returns "null" and GA fails authorization

Open Comoque1 opened this issue 1 year ago • 3 comments

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://alkem.io/graphql
  2. Perform the following query with GA
query SpaceStorageAdminPage($spaceNameId: UUID_NAMEID!) {
  space(ID: $spaceNameId) {
    id
    profile {
      id
      displayName
    }
    storageAggregator {
      ...StorageAggregator
    }
  }
}

fragment StorageAggregator on StorageAggregator {
  id
  parentEntity {
    ...StorageAggregatorParent
  }
  storageAggregators {
    ...LoadableStorageAggregator
  }
  storageBuckets {
    ...StorageBucket
  }
  directStorageBucket {
    ...StorageBucket
    __typename
  }
}

fragment StorageAggregatorParent on StorageAggregatorParent {
  id
  displayName
  url
}

fragment LoadableStorageAggregator on StorageAggregator {
  id
  parentEntity {
    ...StorageAggregatorParent
  }
}

fragment StorageBucket on StorageBucket {
  id
  size
  documents {
    ...DocumentData
  }
  parentEntity {
    ...StorageBucketParent
  }
}

fragment DocumentData on Document {
  id
  displayName
}

fragment StorageBucketParent on StorageBucketParent {
  id
  type
  displayName
  url
}


{
  "spaceNameId": "building-alkemio-org"
}
  1. There are 2 issues
    1. Authorization error: "message": "User ([email protected]) does not have credentials that grant 'read' access to StorageAggregator.parentEntity",
    2. there are storageAggregator.parentEntity: null

Expected behavior All storageAggregator.parentEntity: have values GA don't get such error: "message": "User ([email protected]) does not have credentials that grant 'read' access to StorageAggregator.parentEntity",

Comoque1 avatar Oct 26 '23 20:10 Comoque1

@valentinyanakiev this is to do with storageAggregators it seems. The following query is simpler + still shows the issue:

query SpaceStorageAdminPage($spaceNameId: UUID_NAMEID!) {
  space(ID: $spaceNameId) {
    id
    profile {
      id
      displayName
    }
    storageAggregator {
      ...StorageAggregator
    }
  }
}

fragment StorageAggregator on StorageAggregator {
  id
  parentEntity {
    ...StorageAggregatorParent
  }
  storageAggregators {
    ...LoadableStorageAggregator
  }

}

fragment StorageAggregatorParent on StorageAggregatorParent {
  id
  displayName
  url
}

fragment LoadableStorageAggregator on StorageAggregator {
  id
  parentEntity {
    ...StorageAggregatorParent
  }
}

and then taking one of the storage aggregators that has issues:

query {
  lookup {
    storageAggregator(ID: "d3ff46db-a402-41d3-b168-811b4e081377") {
      id
    }
  }
}

gives

Private Zenhub Image

techsmyth avatar Oct 30 '23 18:10 techsmyth

So this may be a data integrity issue - will need some direct db access to triage further

Note: there are 16 challenges in the space, and the space storage aggregator has 20 children. So either the parent-child relationship on the storage aggregators are set wrong, or there is orphaned data.

techsmyth avatar Oct 30 '23 18:10 techsmyth

The issue is still reproducible on PROD after orphaned data clean up

Comoque1 avatar Sep 27 '24 06:09 Comoque1