Skip to content

GraphQL: Querying for Manufacturer on Inventory-Items leads to nun-null error #18999

@dxks

Description

@dxks

Deployment Type

Self-hosted

NetBox Version

v4.2.5

Python Version

3.10

Steps to Reproduce

Reproducable on demo.netbox.dev. Also on v4.2.6 in our environment

  1. Create a Inventory-Item on any device and leave the manufacturer blank (as it is not required
  2. Query the following graph-ql (with the specific device-id):
query {
  device(id:172) {id name inventoryitems {id name manufacturer{id name}}}
}

Expected Behavior

Output of Device with given Inventory-Items and manufacturer to be null (i.e. like if tenant is not set):

{
  "data": {
    "device": {
      "id": "172",
      "name": "0634LEO",
      "inventoryitems": [
        {
          "id": "1",
          "name": "Test",
          "manufacturer": null
        }
      ]
    }
  }
}

Observed Behavior

Error raised that manufacturer cannot be null:

{
  "data": null,
  "errors": [
    {
      "message": "Cannot return null for non-nullable field InventoryItemType.manufacturer.",
      "locations": [
        {
          "line": 2,
          "column": 68
        }
      ],
      "path": [
        "device",
        "inventoryitems",
        0,
        "manufacturer"
      ]
    }
  ]
}

Metadata

Metadata

Assignees

Labels

severity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationtopic: GraphQLtype: bugA confirmed report of unexpected behavior in the application

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions