graphQL query returns null in attributes #10932

Closed
opened 2025-12-29 21:37:55 +01:00 by adam · 1 comment
Owner

Originally created by @maximparshukov on GitHub (Mar 21, 2025).

Deployment Type

Self-hosted

NetBox Version

4.1.11

Python Version

3.12

Steps to Reproduce

go to https://your_netbox_instance/graphql/
run query
query MyQuery {
device_list(filters: { role_id: "2" }) {
id
primary_ip4 {
address
id
}
oob_ip {
id
address
}
}
}

as result will be

{
"data": {
"device_list": [
{
"id": "228",
"primary_ip4": null,
"oob_ip": null
},
{
"id": "229",
"primary_ip4": null,
"oob_ip": null
}
]

but if set exact id of device like this

query MyQuery {
device_list(filters: {role_id: "2", id: {i_exact: "228"}}) {
id
primary_ip4 {
address
id
}
oob_ip {
id
address
}
}
}

primary_ip4 will be returned

{
"data": {
"device_list": [
{
"id": "228",
"primary_ip4": {
"address": "IP/MASK",
"id": "1468"
},
"oob_ip": null
}
]
}
}

Expected Behavior

run query
query MyQuery {
device_list(filters: { role_id: "2" }) {
id
primary_ip4 {
address
id
}
oob_ip {
id
address
}
}
}

returns

{
"data": {
"device_list": [
{
"id": "228",
"primary_ip4": IP/MASK,
"oob_ip": IP/MASK
},
{
"id": "229",
"primary_ip4": IP/MASK,
"oob_ip": IP/MASK
}
]

Observed Behavior

query

query MyQuery {
device_list(filters: { role_id: "2" }) {
id
primary_ip4 {
address
id
}
oob_ip {
id
address
}
}
}

returns

{
"data": {
"device_list": [
{
"id": "228",
"primary_ip4": null,
"oob_ip": null
},
{
"id": "229",
"primary_ip4": null,
"oob_ip": null
}
]

but if set exact id of device like this

query MyQuery {
device_list(filters: {role_id: "2", id: {i_exact: "228"}}) {
id
primary_ip4 {
address
id
}
oob_ip {
id
address
}
}
}

primary_ip4 will be returned

{
"data": {
"device_list": [
{
"id": "228",
"primary_ip4": {
"address": "IP/MASK",
"id": "1468"
},
"oob_ip": null
}
]
}
}

Originally created by @maximparshukov on GitHub (Mar 21, 2025). ### Deployment Type Self-hosted ### NetBox Version 4.1.11 ### Python Version 3.12 ### Steps to Reproduce go to https://your_netbox_instance/graphql/ run query query MyQuery { device_list(filters: { role_id: "2" }) { id primary_ip4 { address id } oob_ip { id address } } } as result will be { "data": { "device_list": [ { "id": "228", "primary_ip4": null, "oob_ip": null }, { "id": "229", "primary_ip4": null, "oob_ip": null } ] but if set exact id of device like this query MyQuery { device_list(filters: {role_id: "2", id: {i_exact: "228"}}) { id primary_ip4 { address id } oob_ip { id address } } } primary_ip4 will be returned { "data": { "device_list": [ { "id": "228", "primary_ip4": { "address": "IP/MASK", "id": "1468" }, "oob_ip": null } ] } } ### Expected Behavior run query query MyQuery { device_list(filters: { role_id: "2" }) { id primary_ip4 { address id } oob_ip { id address } } } returns { "data": { "device_list": [ { "id": "228", "primary_ip4": IP/MASK, "oob_ip": IP/MASK }, { "id": "229", "primary_ip4": IP/MASK, "oob_ip": IP/MASK } ] ### Observed Behavior query query MyQuery { device_list(filters: { role_id: "2" }) { id primary_ip4 { address id } oob_ip { id address } } } returns { "data": { "device_list": [ { "id": "228", "primary_ip4": null, "oob_ip": null }, { "id": "229", "primary_ip4": null, "oob_ip": null } ] but if set exact id of device like this query MyQuery { device_list(filters: {role_id: "2", id: {i_exact: "228"}}) { id primary_ip4 { address id } oob_ip { id address } } } primary_ip4 will be returned { "data": { "device_list": [ { "id": "228", "primary_ip4": { "address": "IP/MASK", "id": "1468" }, "oob_ip": null } ] } }
adam added the type: bug label 2025-12-29 21:37:55 +01:00
adam closed this issue 2025-12-29 21:37:55 +01:00
Author
Owner

@arthanson commented on GitHub (Mar 24, 2025):

Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v4.2.6. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data.

You didn't include any steps for setting up the data so I'm not sure what you have configured for role_id: 2 and if those actually contain any oob_ips. However I added an oob_ip to a device and did the GraphQL query shown and it did show the oob_ip, see below:

Image
Image

@arthanson commented on GitHub (Mar 24, 2025): Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v4.2.6. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. **Remember to include the steps taken to create any initial objects or other data.** You didn't include any steps for setting up the data so I'm not sure what you have configured for role_id: 2 and if those actually contain any oob_ips. However I added an oob_ip to a device and did the GraphQL query shown and it did show the oob_ip, see below: ![Image](https://github.com/user-attachments/assets/95629195-eec3-45fc-88c2-9c0f94059257) ![Image](https://github.com/user-attachments/assets/68e8d733-3573-4cf7-b737-4e607dcd959a)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10932