You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Uncaught TypeError: Cannot convert undefined or null to object #490
Describe the bug
I use node-js controller, after running npm start and connect to OpenBot on Android, with WebRTC streaming, I got error Uncaught TypeError: Cannot convert undefined or null to object
Screenshots
Desktop (please complete the following information):
OS: MacOS
Browser chrome
Smartphone (please complete the following information):
That error – Uncaught TypeError: Cannot convert undefined or null to object – usually means the app is trying to run Object.keys() on something that’s either undefined or null.
It looks like this is happening in bot-message-handler.js around line 20. Probably some unexpected or malformed data is coming in over the WebRTC connection.
You can add a quick check before using Object.keys() to make sure the message is actually valid!
if (message && typeof message === 'object') {
Object.keys(message).forEach((key) => {
// your existing logic
});
} else {
console.warn("Received invalid message:", message);
}
That should stop the crash and help catch any weird messages for debugging.
Let me know if that works or if you'd like me to send a quick PR with the fix!
This is the same bug that PR #511 addresses. The previous code did (data).status which is a no-op cast (data is a string, so .status is undefined), and the downstream Object.keys(undefined) crashed. The fix in #511 parses the message correctly: JSON.parse(data).status.
Linking to PR #511 so this auto-closes when that lands. Thanks @iwl for the fix and @DKrishna007 for confirming the root cause.
Activity
DKrishna007 commentedon Apr 6, 2025
That error – Uncaught TypeError: Cannot convert undefined or null to object – usually means the app is trying to run Object.keys() on something that’s either undefined or null.
It looks like this is happening in bot-message-handler.js around line 20. Probably some unexpected or malformed data is coming in over the WebRTC connection.
You can add a quick check before using Object.keys() to make sure the message is actually valid!
if (message && typeof message === 'object') {
Object.keys(message).forEach((key) => {
// your existing logic
});
} else {
console.warn("Received invalid message:", message);
}
That should stop the crash and help catch any weird messages for debugging.
Let me know if that works or if you'd like me to send a quick PR with the fix!
iwl commentedon Apr 22, 2026
OpenBot/controller/node-js/client/index.js
Line 20 in 174596d
OpenBot/controller/node-js/client/index.js
Lines 20 to 21 in 65b158d
iwl commentedon Apr 24, 2026
Local NodeWebserverBrowserController updated Node 18-25
FIX: iwl/OpenBot@ddb6c45 git clone https://github.com/iwl/OpenBot
OpenBot/controller/node-js npm install npm start
First connect Browser http://Server:8081 , then OpenBot (close app,retry)
Works Linux, Win10, Firewall Open tcp 19400 (8081 extern Browser)
thias15 commentedon May 9, 2026
This is the same bug that PR #511 addresses. The previous code did
(data).statuswhich is a no-op cast (data is a string, so.statusisundefined), and the downstreamObject.keys(undefined)crashed. The fix in #511 parses the message correctly:JSON.parse(data).status.Linking to PR #511 so this auto-closes when that lands. Thanks @iwl for the fix and @DKrishna007 for confirming the root cause.