Graphql error returned when querying IP addresses and returning assigned_object in v4.0-beta1 #9515

Closed
opened 2025-12-29 20:50:51 +01:00 by adam · 0 comments
Owner

Originally created by @atownson on GitHub (Apr 22, 2024).

Originally assigned to: @arthanson on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.0-beta1

Python Version

3.10

Steps to Reproduce

Run the following query against the Strawberry Graphql endpoint:

{
  ip_address_list {
    id
    assigned_object {
      __typename
      ... on InterfaceType {
        id
        name
        device {
          name
        }
      }
      ... on FHRPGroupType {
        id
        name
      }
      ... on VMInterfaceType {
        id
        name
      }
    }
  }
}

Expected Behavior

The expected results are returned:

{
  "data": {
    "ip_address_list": [
      {
        "id": "1",
        "assigned_object": {
          "__typename": "InterfaceType",
          "id": "1",
          "name": "GigabitEthernet0/0/0",
          "device": {
            "name": "test"
          }
        }
      },
      {
        "id": "2",
        "assigned_object": null
      }
    ]
  }
}

Observed Behavior

An error response is returned:

{
  "data": null,
  "errors": [
    {
      "message": "Cannot return null for non-nullable field IPAddressType.assigned_object.",
      "locations": [
        {
          "line": 4,
          "column": 5
        }
      ],
      "path": [
        "ip_address_list",
        2,
        "assigned_object"
      ]
    }
  ]
}
Originally created by @atownson on GitHub (Apr 22, 2024). Originally assigned to: @arthanson on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.0-beta1 ### Python Version 3.10 ### Steps to Reproduce Run the following query against the Strawberry Graphql endpoint: ``` { ip_address_list { id assigned_object { __typename ... on InterfaceType { id name device { name } } ... on FHRPGroupType { id name } ... on VMInterfaceType { id name } } } } ``` ### Expected Behavior The expected results are returned: ``` { "data": { "ip_address_list": [ { "id": "1", "assigned_object": { "__typename": "InterfaceType", "id": "1", "name": "GigabitEthernet0/0/0", "device": { "name": "test" } } }, { "id": "2", "assigned_object": null } ] } } ``` ### Observed Behavior An error response is returned: ``` { "data": null, "errors": [ { "message": "Cannot return null for non-nullable field IPAddressType.assigned_object.", "locations": [ { "line": 4, "column": 5 } ], "path": [ "ip_address_list", 2, "assigned_object" ] } ] } ```
adam added the type: bugstatus: acceptedbetaseverity: medium labels 2025-12-29 20:50:51 +01:00
adam closed this issue 2025-12-29 20:50:51 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9515