Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dehann opened this issue May 11, 2023 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@dehann
Copy link
Member

dehann commented May 11, 2023

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
@dehann dehann added the bug Something isn't working label May 11, 2023
@dehann dehann added this to the v0.6.1 milestone May 11, 2023
@Affie
Copy link
Member

Affie commented May 11, 2023

Just error looks to be caused #112

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants