Repository navigation
Closed
Description
Environment
- SYSTEM: manufacturer: Apple Inc.; model: Macmini9,1; virtual: false; MM: v2.35.0
- OS: platform: darwin; distro: macOS; release: 26.4; arch: arm64; kernel: 25.4.0
- VERSIONS: electron: 41.1.0; used node: 22.21.1; installed node: 22.21.1; npm: 10.9.4; pm2: 6.0.14
- ENV: XDG_SESSION_TYPE: undefined; MM_CONFIG_FILE: undefined
WAYLAND_DISPLAY: undefined; DISPLAY: :0; ELECTRON_ENABLE_GPU: undefined - RAM: total: 16384.00 MB; free: 232.66 MB; used: 16151.34 MB
- OTHERS: uptime: 809 minutes; timeZone: America/Chicago
Which start option are you using?
node --run start:x11
Are you using PM2?
No
Module
None
Have you tried disabling other modules?
- Yes
- No
Have you searched if someone else has already reported the issue on the forum or in the issues?
- Yes
What did you do?
Configuration
[config.js](https://github.com/user-attachments/files/26481565/config.js)
<!-- Paste relevant code here -->Steps to reproduce the issue:
in my MMM-Config, I use the same socket.io parent as used by MagicMirror , passed this.io in the node_helper
use like this
socketIOPath = "mConfig"
this.io.of(socketIOPath).on("hello",function(){
console.log("heard hello from client")
})
What did you expect to happen?
no errors
What actually happened?
get repeating socket.io error, not fatal
[2026-04-04 09:59:36.108] [ERROR] [app] Whoops! There was an uncaught exception...
[2026-04-04 09:59:36.108] [ERROR] [app] TypeError: Cannot read properties of undefined (reading 'hideConfigSecrets')
at Socket.<anonymous> (/Users/sam/MagicMirror/js/node_helper.js:92:16)
at Socket.onevent (/Users/sam/MagicMirror/node_modules/socket.io/dist/socket.js:462:26)
at Socket._onpacket (/Users/sam/MagicMirror/node_modules/socket.io/dist/socket.js:430:22)
at /Users/sam/MagicMirror/node_modules/socket.io/dist/client.js:207:24
at process.processTicksAndRejections (node:internal/process/task_queues:85:11)
Additional comments
No response
Participation
- I am willing to submit a pull request for this change.
Activity
khassel commentedon Apr 4, 2026
I introduced this with latest release in
node_helper.js:But I don't understand your usecase. Maybe
configis undefined becausehideConfigSecretsis defined indefaults.js.Can you test if it works with
if (config && config.hideConfigSecrets && payload && typeof payload === "object") {or
if global.config.hideConfigSecrets && payload && typeof payload === "object") {sdetweil commentedon Apr 4, 2026
no error with either suggested choice
my config.js is prior version
khassel commentedon Apr 4, 2026
but
hideConfigSecretsshould be merged fromdefaults.js, can you insert aconsole.dir(config)before the if statement?KristjanESPERANTO commentedon Apr 4, 2026
One question regarding the MMM-Config module: would it be possible to use the normal MagicMirror API instead of accessing
this.iodirectly?Accessing
this.iois an internal implementation detail and bypasses MM middleware likehideConfigSecrets. Using the public API seems to be cleaner and less likely to break with future MM updates.sdetweil commentedon Apr 4, 2026
Yes, will be a couple hours
sdetweil commentedon Apr 4, 2026
@KristjanESPERANTO what is the public socket.io api for using the same port
io and expressApp are passed to helpers for the purpose of using them on the same setup.
KristjanESPERANTO commentedon Apr 4, 2026
Ah, I had a look at the MMM-Config code - yes, my suggestion won't work. The client connecting to the
mConfignamespace is an external browser page (form-client.js), not another MagicMirror module. So the normalsocketNotificationReceived/sendSocketNotificationAPI isn't an option. Sorry for the noise.sdetweil commentedon Apr 4, 2026
console.log(config) and console.dir(config) both return undefined
I was wrong earlier..
if (config && ... works ok
if(global.config.hideConfigSecrets
and fails every time after the system info section
sdetweil commentedon Apr 4, 2026
@KristjanESPERANTO yes, I use socket.io emit() and socket.io.on('submit') etc to move the form data to the browser page and collect the page events and form data back
khassel commentedon Apr 4, 2026
Will you create a pull request to fix this issue, or should I do it?
sdetweil commentedon Apr 4, 2026
I will. Might be Monday. Traveling thru tomorrow, and have company now
fix(node_helper): prevent crash when config is undefined in socket ha…
fix: prevent crash when config is undefined in socket handler
KristjanESPERANTO commentedon Apr 7, 2026
I've created #4096 to fix this 🙂
fix: prevent crash when config is undefined in socket handler (#4096)
sdetweil commentedon Apr 10, 2026
actually I think this fix is wrong as there is still the else clause
cause there should be no socketnotification calls on ANY of my socketio calls. and I am not passing notification or payload
but I only see one notification event.. so I am confused
KristjanESPERANTO commentedon Apr 10, 2026
I think the current fix is not wrong; it correctly resolves the reported crash when
configis undefined in this path.Your new point seems valid and important: which Socket.IO events should be forwarded to
socketNotificationReceivedat all? Am I understanding this correctly?Could these perhaps be possible approaches (I haven't fully thought either of these through yet, so they're for brainstorming):
khassel commentedon Apr 10, 2026
The line
this.socketNotificationReceived(notification, payload);was not introduced with latest release, it was already in this function several releases before ...sdetweil commentedon Apr 10, 2026
Yes, I understand, but I wasn’t aware of this onAny() hook and what it does…