Skip to content

complete getUser w/ robots and sessions gives duplicate GQL fragments error #140

@dehann

Description

@dehann

getUser does not currently populate it's .robots of .robots.sessions fields. But when doing the fix in users.toml:

query QUERY_GET_USER (
  $userLabel: EmailAddress!
  ) {
    users (where: {label: $userLabel}) {
    ...FRAGMENT_USER
    robots {
      ...FRAGMENT_ROBOT
      sessions {
        ...FRAGMENT_SESSION
      }
    }
  }
}

A new duplicate fragments error with gql occurs. See error stack below...

The error relates to BLOBENTRY GQL fragment being loaded multiple times in the nested user-robot-sessions GQL above. There is chatter on this issue for Python's GQL in general, e.g.:

Note the query above works in playground, and also already released via SDK.jl.


In : usr = await getUser(ngc, userLabel)
Traceback (most recent call last):
  File "/usr/lib/python3.8/asyncio/__main__.py", line 58, in runcode
    return future.result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 444, in result
    return self.__get_result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
  File "<console>", line 1, in <module>
  File "/home/dehann/software/NavAbility/NavAbilitySDK.py/src/navability/services/user.py", line 34, in getUser
    resp = await navAbilityClient.query(
  File "/home/dehann/software/NavAbility/NavAbilitySDK.py/src/navability/entities/navabilityclient.py", line 81, in query
    result = await client.execute(options.query, options.variables)
  File "/home/dehann/.local/lib/python3.8/site-packages/gql/client.py", line 408, in execute
    result = await self._execute(document, *args, **kwargs)
  File "/home/dehann/.local/lib/python3.8/site-packages/gql/client.py", line 393, in _execute
    self.client.validate(document)
  File "/home/dehann/.local/lib/python3.8/site-packages/gql/client.py", line 117, in validate
    raise validation_errors[0]
graphql.error.graphql_error.GraphQLError: There can be only one fragment named 'FRAGMENT_BLOBENTRY'.

GraphQL request:13:10
12 |
13 | fragment FRAGMENT_BLOBENTRY on BlobEntry {
   |          ^
14 |   id

GraphQL request:49:10
48 |
49 | fragment FRAGMENT_BLOBENTRY on BlobEntry {
   |          ^
50 |   id

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions