Open rickde92 opened 9 months ago
there is a bug in the node helper
config.baseUrl + 'api/status-page/'
the base url doesn't have a trailing '/'
so this creates a damaged url
this is what I changed
const statusPagePromise = axios.get(config.baseUrl + (config.baseUrl.endsWith('/') ? '' : '/') + 'api/status-page/' + config.statusPage);
const heartbeatPromise = axios.get(config.baseUrl + (config.baseUrl.endsWith('/') ? '' : '/') + 'api/status-page/heartbeat/' + config.statusPage);
or add a / to the end of the baseurl property in config
config
{//MMM-uptimekuma- top_left
module: 'MMM-uptimekuma',
position: "top_left",
header: "Uptime-Kuma",
config: {
baseUrl: "http://10.0.12.13:3001/",
}
},
error.
0|MagicMir | at /home/admin/MagicMirror/modules/MMM-uptimekuma/node_helper.js:61:45
0|MagicMir | at Array.map (--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 46)
0|MagicMir | [26.02.2024 16:03.21.297] [ERROR] (node:1280) UnhandledPromiseRejectionWarning: TypeError: Cannot read properties of undefined (reading 'status')
0|MagicMir | at /home/admin/MagicMirror/modules/MMM-uptimekuma/node_helper.js:63:68
0|MagicMir | at Array.map (--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 50)
`
There is no longer a status query in the "http://10.0.12.13:3001/api/status-page/default" whether the server is online or not.
@rickde92 I get one just fine after I created the default status page and added a monitor to it and fixed the url
{"config":{"slug":"default","title":"default","description":null,"icon":"/icon.svg","theme":"auto","published":true,"showTags":false,"customCSS":"body {\n \n}\n","footerText":null,"showPoweredBy":true,"googleAnalyticsId":null,"showCertificateExpiry":false},"incident":null,"publicGroupList":[{"id":1,"name":"Services","weight":1,"monitorList":[{"id":1,"name":"cnsearch","sendUrl":1,"type":"http","url":"https://bbbbbbbbb"}]}],"maintenanceList":[]}
and my heartbeat data from
http://mac-mini:3001/api/status-page/heartbeat/
is
{"heartbeatList":{},"uptimeList":{}}
I don't have any heartbeat data in my monitor on the status page.. don't see how to get any
this is looking for the status from the heartbeat data
properties of undefined (reading 'status')
0|MagicMir | at /home/admin/MagicMirror/modules/MMM-uptimekuma/node_helper.js:63:68
and my heartbeat data from
http://mac-mini:3001/api/status-page/heartbeat/
is
{"heartbeatList":{},"uptimeList":{}}
Because you're not specifying the slug for the status page. Check at http://mac-mini:3001/api/status-page/heartbeat/default
and hopefully you'll see status objects.
@rickde92, I'm afraid I'm not clear on the issue you're seeing. Are you able to load the status page itself?
@MikeBishop The Status page works great.
yes, I see the status objects... and the last is used to up/down determination
@rickde92, if the status page loads, presumably that means the API endpoints are returning valid data. What is happening in the node_helper when it tries to fetch the data?
@MikeBishop How can I verify that? Sry, I'm new to MagicMirror :)
@rickde92 the module would have to provide debug output. I added some to see the heartbeat list
add a debug property pass it to the node_helper and conditionally console log important info
in my "/api/status-page/default" is on the list so Status item.