Ensure that remote instance logs are disabled if no MQTT configured.
- Dominant language
- JavaScript
- Stars
- 400
- Forks
- 89
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 149
Description
### Current Behavior
Device Agent to FF Platform transport of NR logs requires MQTT messages to be enabled.
It looks like the UI is still showing the logs option even if no broker is configured which leads to a crash when the API tries to signal the device agent to start sending logs.
```
/usr/src/forge/app/node_modules/@flowfuse/flowfuse/forge/routes/api/device.js:893
app.comms.devices.sendCommand(team.hashid, request.device.hashid, 'startLog', '')
^
TypeError: Cannot read properties of undefined (reading 'devices')
at Timeout._onTimeout (/usr/src/forge/app/node_modules/@flowfuse/flowfuse/forge/routes/api/device.js:893:23)
at listOnTimeout (node:internal/timers:581:17)
at process.processTimers (node:internal/timers:519:7)
```
### Expected Behavior
- NR Logs tab should be hidden in the UI when broker not enabled/configured
- Device API should not try and enable logging if no broker enabled/configured.
### Steps To Reproduce
- Start FF platform with no MQTT broker configured
- Add and deploy device
- try to open logs for device
### Environment
- FlowFuse version: 2.26.x
- Node.js version: 20.x
- npm version: 10.x
- Platform/OS: all
- Browser: all
### Have you provided an initial effort estimate for this issue?
I have provided an initial effort estimate
Contributor guide
Research direction
Start with forge/routes/api/device.js around line 893 and trace how the NR Logs tab and MQTT broker configuration are handled. Reproduce the issue with no broker configured; done means the tab is hidden and the Device API does not attempt to enable logging.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- api, full-stack
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100