Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught (in promise) ReferenceError: moment is not defined, Uncaught (in promise) TypeError: Cannot read properties of null (reading 'style') #20

Closed
fire1ce opened this issue Jul 18, 2023 · 3 comments

Comments

@fire1ce
Copy link

fire1ce commented Jul 18, 2023

Console errors:

image

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)
@fire1ce
Copy link
Author

fire1ce commented Jul 18, 2023

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.

@Fabrizz
Copy link
Owner

Fabrizz commented Jul 20, 2023

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

@fire1ce
Copy link
Author

fire1ce commented Jul 20, 2023

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.

@Fabrizz Fabrizz closed this as completed Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants