Closed aurely89 closed 3 years ago
Good check already on BOM and UTF, as the stack trace indicates the issue is in
var json = JSON.parse(body);
Can you supply the output for some vars over there by adding console.log('debug', error, response, body); on line 13 https://github.com/timdows/MMM-JsonTable/blob/master/node_helper.js#L13
Sure, here it is the console log:
[2020-09-24 14:33:40.830] [ERROR] Whoops! There was an uncaught exception...
[2020-09-24 14:33:40.831] [ERROR] ReferenceError: error is not defined
at Class.getJson (/home/pi/MagicMirror/modules/MMM-JsonTable/node_helper.js:11:24)
at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-JsonTable/node_helper.js:25:9)
at Socket.<anonymous> (/home/pi/MagicMirror/js/node_helper.js:112:11)
at Socket.emit (events.js:200:13)
at /home/pi/MagicMirror/node_modules/socket.io/lib/socket.js:528:12
at processTicksAndRejections (internal/process/task_queues.js:82:9)
[2020-09-24 14:33:40.849] [ERROR] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
[2020-09-24 14:33:40.851] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
[2020-09-24 14:33:41.980] [INFO] Checking git for module: MMM-JsonTable
Username for 'https://github.com': Username for 'https://github.com': [2020-09-24 14:33:46.006] [LOG] starting network connection testing
[2020-09-24 14:33:51.634] [ERROR] Whoops! There was an uncaught exception...
[2020-09-24 14:33:51.636] [ERROR] ReferenceError: error is not defined
at Class.getJson (/home/pi/MagicMirror/modules/MMM-JsonTable/node_helper.js:11:24)
at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-JsonTable/node_helper.js:25:9)
at Socket.<anonymous> (/home/pi/MagicMirror/js/node_helper.js:112:11)
at Socket.emit (events.js:200:13)
at /home/pi/MagicMirror/node_modules/socket.io/lib/socket.js:528:12
at processTicksAndRejections (internal/process/task_queues.js:82:9)
[2020-09-24 14:33:51.641] [ERROR] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
[2020-09-24 14:33:51.642] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
[2020-09-24 14:34:06.021] [ERROR] Whoops! There was an uncaught exception...
[2020-09-24 14:34:06.022] [ERROR] ReferenceError: error is not defined
at Class.getJson (/home/pi/MagicMirror/modules/MMM-JsonTable/node_helper.js:11:24)
at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-JsonTable/node_helper.js:25:9)
at Socket.<anonymous> (/home/pi/MagicMirror/js/node_helper.js:112:11)
at Socket.emit (events.js:200:13)
at /home/pi/MagicMirror/node_modules/socket.io/lib/socket.js:528:12
at processTicksAndRejections (internal/process/task_queues.js:82:9)
[2020-09-24 14:34:06.023] [ERROR] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
[2020-09-24 14:34:06.024] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
[2020-09-24 14:34:21.840] [ERROR] Whoops! There was an uncaught exception...
[2020-09-24 14:34:21.840] [ERROR] ReferenceError: error is not defined
at Class.getJson (/home/pi/MagicMirror/modules/MMM-JsonTable/node_helper.js:11:24)
at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-JsonTable/node_helper.js:25:9)
at Socket.<anonymous> (/home/pi/MagicMirror/js/node_helper.js:112:11)
at Socket.emit (events.js:200:13)
at /home/pi/MagicMirror/node_modules/socket.io/lib/socket.js:528:12
at processTicksAndRejections (internal/process/task_queues.js:82:9)
[2020-09-24 14:34:21.842] [ERROR] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
[2020-09-24 14:34:21.843] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
Wait, I just see your url
http://192.168.1.50/home/pi/MagicMirror/modules/MMM-JsonTable/prova.json
Is this really working? Can you supply the raw output (show it in dev console of a broswer)?
What if you supply the following configuration
module: 'MMM-JsonTable',
position: 'top_right',
config: {
url: 'https://jsonplaceholder.typicode.com/users',
keepColumns: ['name', 'username']
}
Hi @timdows, I've had the same problem with the JSON file on a NAS or on a cloud drive.
I've tried with the config you've sent and the module still displays 'Awaiting json data' but I see a different error on the console log:
[2020-09-25 13:11:30.348] [ERROR] Whoops! There was an uncaught exception...
[2020-09-25 13:11:30.350] [ERROR] ReferenceError: error is not defined
at Class.getJson (/home/pi/MagicMirror/modules/MMM-JsonTable/node_helper.js:11:24)
at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-JsonTable/node_helper.js:25:9)
at Socket.<anonymous> (/home/pi/MagicMirror/js/node_helper.js:112:11)
at Socket.emit (events.js:200:13)
at /home/pi/MagicMirror/node_modules/socket.io/lib/socket.js:528:12
at processTicksAndRejections (internal/process/task_queues.js:82:9)
[2020-09-25 13:11:30.353] [ERROR] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
[2020-09-25 13:11:30.354] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
Of course try that config with the original node_helper.js file
Oh, sure. It is correctly working now, so I guess it was a reachability problem.
Thank you very much @timdows!
Hi @timdows , I've tried to solve this for two days by now but with no luck.
Hope you can help since I can't really see where the problem with position 5 is.
From console log I have this error:
This is the config array:
While this is the JSON content (UTF encoded, no BOM characters):
Thank you in advance for your precious support.
Flavio