Uncaught (in promise) ReferenceError: moment is not defined, Uncaught (in promise) TypeError: Cannot read properties of null (reading 'style')
fire1ce opened this issue · comments
Console errors:
SpotifyDomBuilder.js:770 Uncaught (in promise) ReferenceError: moment is not defined
at SpotifyDomBuilder.getSanitizedTime (SpotifyDomBuilder.js:770:16)
at SpotifyDomBuilder.getPlayerData (SpotifyDomBuilder.js:341:27)
at SpotifyDomBuilder.nowPlaying (SpotifyDomBuilder.js:171:30)
at Class.getDom (MMM-OnSpotify.js:218:27)
at main.js:110:35
at new Promise (<anonymous>)
at updateDom (main.js:108:10)
at Object.updateDom (main.js:531:4)
at Class.updateDom (module.js:333:6)
at Class.smartUpdate (MMM-OnSpotify.js:546:21)
getSanitizedTime @ SpotifyDomBuilder.js:770
getPlayerData @ SpotifyDomBuilder.js:341
nowPlaying @ SpotifyDomBuilder.js:171
getDom @ MMM-OnSpotify.js:218
(anonymous) @ main.js:110
updateDom @ main.js:108
updateDom @ main.js:531
updateDom @ module.js:333
smartUpdate @ MMM-OnSpotify.js:546
socketNotificationReceived @ MMM-OnSpotify.js:300
(anonymous) @ module.js:232
(anonymous) @ socketclient.js:38
Emitter.emit @ index.mjs:136
emitEvent @ socket.js:498
onevent @ socket.js:485
MMSocket.socket.onevent @ socketclient.js:32
onpacket @ socket.js:455
Emitter.emit @ index.mjs:136
(anonymous) @ manager.js:204
Promise.then (async)
(anonymous) @ websocket-constructor.browser.js:5
ondecoded @ manager.js:203
Emitter.emit @ index.mjs:136
add @ index.js:146
ondata @ manager.js:190
Emitter.emit @ index.mjs:136
onPacket @ socket.js:339
Emitter.emit @ index.mjs:136
onPacket @ transport.js:98
onData @ transport.js:90
ws.onmessage @ websocket.js:68
30SpotifyDomBuilder.js:398 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'style')
at SpotifyDomBuilder.updatePlayerData (SpotifyDomBuilder.js:398:14)
at Class.smartUpdate (MMM-OnSpotify.js:557:29)
at Class.socketNotificationReceived (MMM-OnSpotify.js:300:14)
at module.js:232:9
at Socket.<anonymous> (socketclient.js:38:4)
at Emitter.emit (index.mjs:136:20)
at Socket.emitEvent (socket.js:498:20)
at Socket.onevent (socket.js:485:18)
at MMSocket.socket.onevent (socketclient.js:32:11)
at Socket.onpacket (socket.js:455:22)
This issue exists when no other module including default is loaded to the dom.
I think you are using existing loaded modules from other modules.
you can reproduce it by loading as single module of MMM-OnSpotify
in the config.js
of the MagicMirror.
That is strange, as its not loading the moment library (vibrant also is loaded but it cannot find it, as the colors on the left do not match). I was going to suggest doing a clean dependencies install, but its loading them to the browser correctly. Can you try not using HTTPS? (Just to know), also doing a CTRL + F5 should clean your browser cache
Like i mentioned before. The issue only happens ONLY when no other module is loaded before this one. I've tested with new MagicMirror Image + new npm modules. as clean as it can be. there is a big chance the issue is in the core of the MagicMirror since i've encountered something similar.
I've already open an issue about it: https://github.com/MichMich/MagicMirror/issues/3143
Might be connected.