Skip to content

Graphql filters to same attribute #17883

Description

@SRF-rueeggdo

Deployment Type

Self-hosted

Triage priority

N/A

NetBox Version

v4.1.4

Python Version

3.11

Steps to Reproduce

  1. execute the following query in the GraphiQL web interface. It should work.
  2. run the query below as a curl command. This will return an error.

GraphiQL:

{
  border_leaf_list: device_list(
    filters: {tag: "avd", virtual_chassis_member: false, status: "active", role: "border-leaf", site: "iplab"}
  ) {
    name
    loopback_interfaces: interfaces(filters: {type: {exact: "virtual"}}) {
      name
      description
      type
      ip_addresses {
        address
        vrf {
          name
        }
      }
    }
    svi_interfaces: interfaces(filters: {type: {exact: "bridge"}}) {
      name
      description
      type
      ip_addresses {
        address
      }
    }
  }
}

CLI:

curl -H "Authorization: Token YOURTOKEN" \
     -H "Content-Type: application/json" \
     -H "Accept: application/json" \
     https://YOURURL/graphql/ \
     --data '{"query": "query {border_leaf_list: device_list(filters: {tag: \"avd\", virtual_chassis_member: false, status: \"active\", role: \"border-leaf\", site: \"iplab\"}) {name loopback_interfaces: interfaces(filters: {type: {exact: \"virtual\"}}) {name description type ip_addresses {address vrf {name}}} svi_interfaces: interfaces(filters: {type: {exact: \"bridge\"}}) {name description type ip_addresses {address}}}}"}'

Expected Behavior

The query should return this.

{
  "data": {
    "border_leaf_list": [
      {
        "name": "ZHFER-SCB9211-A",
        "svi_interfaces": []
      },
      {
        "name": "ZHFER-SCB9211-B",
        "svi_interfaces": []
      }
    ]
  }
}

Observed Behavior

The curl command returns this insted.

{"data": null, "errors": [{"message": "Tried to prefetch 2 queries with different filters to the same attribute. Use `to_attr` in this case...", "locations": [{"line": 1, "column": 8}], "path": ["border_leaf_list"]}]}

Metadata

Metadata

Assignees

No one assigned

    Labels

    netboxpending closureRequires immediate attention to avoid being closed for inactivitystatus: revisions neededThis issue requires additional information to be actionabletype: bugA confirmed report of unexpected behavior in the application

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions