GraphQL related field queries return the wrong data #7356

Closed
opened 2025-12-29 20:22:15 +01:00 by adam · 2 comments
Owner

Originally created by @Spaceman1701 on GitHub (Dec 14, 2022).

NetBox version

v3.4.0-beta1

Python version

3.8

Steps to Reproduce

You can see this bug in a number of ways, here's the easiest:

  1. Have a Netbox 3.4.0-beta1 instance with multiple devices where each device has multiple interfaces
  2. In the GraphQL explorer environment write the following query with a valid device ID:
{
  device(id: <YOUR-DEVICE-ID-GOES-HERE>) {
    name
    interfaces {
      id
    }
  }
}

Expected Behavior

The query above should return a response that contains the requested device's name and a the list of that device's interfaces.

To put it another way:

{
  device(id: <YOUR-DEVICE-ID-GOES-HERE>) {
    name
    interfaces {
      id
    }
  }
}

and:

{
  device(id: <YOUR-DEVICE-ID-GOES-HERE>) {
    name
    interfaces(device_id: "<YOUR-DEVICE-ID-GOES-HERE>") {
      id
    }
  }
}

should return an identical response.

Observed Behavior

The query returns a response with the device's name but too many interfaces. I'm not sure if it's all the interfaces or some subset of them.

However,

{
  device(id: <YOUR-DEVICE-ID-GOES-HERE>) {
    name
    interfaces(device_id: "<YOUR-DEVICE-ID-GOES-HERE>") {
      id
    }
  }
}

Returns the expected (and correct) response.

I think this is related to #10618 because the incorrect behavior is new since Netbox 3.3.x. As far as I can tell, this behavior isn't limited to just device's and interfaces. It seems to be present in many relations.

If the data on the beta-demo instance hasn't changed since I created this issue, you can view the issue easily here: https://beta-demo.netbox.dev/graphql/#query=%7B%0A%20%20device(id%3A%209)%20%7B%0A%20%20%20%20name%0A%20%20%20%20interfaces%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D

Originally created by @Spaceman1701 on GitHub (Dec 14, 2022). ### NetBox version v3.4.0-beta1 ### Python version 3.8 ### Steps to Reproduce You can see this bug in a number of ways, here's the easiest: 1. Have a Netbox 3.4.0-beta1 instance with multiple devices where each device has multiple interfaces 2. In the GraphQL explorer environment write the following query with a valid device ID: ``` { device(id: <YOUR-DEVICE-ID-GOES-HERE>) { name interfaces { id } } } ``` ### Expected Behavior The query above should return a response that contains the requested device's name and a the list of that device's interfaces. To put it another way: ``` { device(id: <YOUR-DEVICE-ID-GOES-HERE>) { name interfaces { id } } } ``` and: ``` { device(id: <YOUR-DEVICE-ID-GOES-HERE>) { name interfaces(device_id: "<YOUR-DEVICE-ID-GOES-HERE>") { id } } } ``` should return an identical response. ### Observed Behavior The query returns a response with the device's name but too many interfaces. I'm not sure if it's all the interfaces or some subset of them. However, ``` { device(id: <YOUR-DEVICE-ID-GOES-HERE>) { name interfaces(device_id: "<YOUR-DEVICE-ID-GOES-HERE>") { id } } } ``` Returns the expected (and correct) response. I think this is related to #10618 because the incorrect behavior is new since Netbox 3.3.x. As far as I can tell, this behavior isn't limited to just device's and interfaces. It seems to be present in many relations. If the data on the `beta-demo` instance hasn't changed since I created this issue, you can view the issue easily here: https://beta-demo.netbox.dev/graphql/#query=%7B%0A%20%20device(id%3A%209)%20%7B%0A%20%20%20%20name%0A%20%20%20%20interfaces%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D
adam added the type: bug label 2025-12-29 20:22:15 +01:00
adam closed this issue 2025-12-29 20:22:15 +01:00
Author
Owner

@arthanson commented on GitHub (Dec 14, 2022):

@Spaceman1701 this should be already fixed in the just released NetBox 3.4.

@arthanson commented on GitHub (Dec 14, 2022): @Spaceman1701 this should be already fixed in the just released NetBox 3.4.
Author
Owner

@Spaceman1701 commented on GitHub (Dec 14, 2022):

oh, fantastic! I just setup an instance of the final 3.4.0 release and I see that it's fixed.

@Spaceman1701 commented on GitHub (Dec 14, 2022): oh, fantastic! I just setup an instance of the final `3.4.0` release and I see that it's fixed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7356