Skip to content

Fix empty scope.nodes causing 400 Bad Request#48

Closed
ktsaou wants to merge 1 commit intomasterfrom
fix/empty-scope-nodes
Closed

Fix empty scope.nodes causing 400 Bad Request#48
ktsaou wants to merge 1 commit intomasterfrom
fix/empty-scope-nodes

Conversation

@ktsaou
Copy link
Member

@ktsaou ktsaou commented Jan 28, 2026

Summary

  • When no nodes are selected in the Grafana query editor, the plugin was sending scope.nodes: [] (empty array) to the Netdata Cloud API
  • The API rejects empty arrays with 400 Bad Request
  • This fix uses wildcard ['*'] when no nodes are selected, matching the UI tooltip behavior ("No selected Nodes means 'All Nodes' from the Room")

Root Cause

In src/shared/hooks/useGetChartData.ts, the nodes parameter defaulted to an empty array and was passed directly to scope.nodes without handling the "no selection = all nodes" case.

Changes

  • useGetChartData.ts: Changed nodes, to nodes: nodes.length ? nodes : ['*'],

This is consistent with how selectors.nodes already uses ['*'] (line 69) and how dimensions and labels use defaultSelectorValue when empty.

Testing

  • Lint passes (0 errors)
  • Build passes
  • Manual testing in Grafana with Netdata datasource

Fixes netdata/netdata-cloud#1132

When no nodes are selected, use wildcard ['*'] instead of empty array
to match the documented behavior ("No selected Nodes means All Nodes").

Fixes netdata/netdata-cloud#1132
@ktsaou
Copy link
Member Author

ktsaou commented Jan 28, 2026

@novykh check this

@novykh
Copy link
Member

novykh commented Jan 28, 2026

@ktsaou this wont fix it, since scope nodes are being sent to the cloud backend, where we use empty array for all nodes. If the backend was the agent then it would work. Please share what is braking so I can check it.

@novykh
Copy link
Member

novykh commented Jan 28, 2026

We can close this in favour of this. @ktsaou please approve.

@novykh novykh closed this Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Netdata and Grafana integration - queries send empty scope.nodes and fail with 400 Bad Request

2 participants