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

bug: Unhandled exception when a BuiltinIPAddress have 2 BuiltinIPPrefix #5474

Open
BeArchiTek opened this issue Jan 15, 2025 · 0 comments
Open
Assignees
Labels
group/backend Issue related to the backend (API Server, Git Agent) type/bug Something isn't working as expected

Comments

@BeArchiTek
Copy link
Contributor

Component

API Server / GraphQL

Infrahub version

1.1.2

Current Behavior

When querying IP Addresses, and one of them has several ip_prefix, the Graphql API reply a cryptic :

At most, one relationship expected', 'locations': [{'line': 3, 'column': 5}], 'path': ['IpamIPAddress']}]

In the server logs we can see

2025-01-15T13:30:24.159409Z [critical ] Unhandled exception occurred in resolvers [infrahub.graphql] app=infrahub.api request_id=1aeebf7cdd5b403d846be791db37e555 worker=0b945a9c-befd-4629-91fa-56d9e810bb22
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/graphql/execution/execute.py", line 530, in await_result
    return_type, field_nodes, info, path, await result
                                          ^^^^^^^^^^^^
  File "/source/backend/infrahub/graphql/resolvers/resolver.py", line 166, in default_paginated_list_resolver
    objs = await NodeManager.query(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/source/backend/infrahub/core/manager.py", line 251, in query
    response = await cls.get_many(
               ^^^^^^^^^^^^^^^^^^^
  File "/source/backend/infrahub/core/manager.py", line 1184, in get_many
    await cls._enrich_node_dicts_with_relationships(
  File "/source/backend/infrahub/core/manager.py", line 1253, in _enrich_node_dicts_with_relationships
    await cls._enrich_one_node_with_relationships(
  File "/source/backend/infrahub/core/manager.py", line 1301, in _enrich_one_node_with_relationships
    raise ValueError("At most, one relationship expected")
ValueError: At most, one relationship expected

Expected Behavior

Error should be gratefully handled and the API should reply which IP has an issue as other Graphql Error we are currently sending

EDIT: We should not be in this case as the "ip_prefix" should be properly update, for which I will open another issue

Steps to Reproduce

  • using demo-dc-fabric with infrahub-sdk 1.5.0 and infrahub 1.1.2
  • load all the data
  • Try retrieving the IP address with client.all("InfraIPAddress")

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group/backend Issue related to the backend (API Server, Git Agent) type/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

3 participants