jalibu / MMM-Jast

A minimalistic stock ticker based on Yahoo's finance API for the MagicMirror² platform.
MIT License
70 stars 22 forks source link

UNDEFINED on the screen and "template read error..." in the debug messages. #25

Closed jpiatt closed 3 years ago

jpiatt commented 3 years ago

Platform

MAC OS 11.5.2

Node.js Version

14.15.4

MagicMirror Version

2.14.0

Module Version

1cd39c3d95544fa336448d8e7ddd4599aeb675e3

Description

Module fails leaving message "UNDEFINED" on mirror. This is occurring on my Mac running MAC OS 11.5.2. This is typically where I test my code changes before uploading them to the Raspberry Pi that runs the actual mirror.

Expected behavior

No response

Current behavior

No response

Possible solution

No response

Steps to reproduce

This occurs when the module starts.

Log

template render error: (templates/MMM-Jast.njk) [Line 16, Column 42]
  TypeError: Cannot read property 'toLocaleString' of undefined
    at Object.n.t (http://localhost:8080/vendor/node_modules/nunjucks/browser/nunjucks.min.js:2:2466)
    at http://localhost:8080/vendor/node_modules/nunjucks/browser/nunjucks.min.js:2:37398
    at eval (eval at i.B (http://localhost:8080/vendor/node_modules/nunjucks/browser/nunjucks.min.js:2:38002), <anonymous>:22:11)
    at http://localhost:8080/vendor/node_modules/nunjucks/browser/nunjucks.min.js:2:37756
    at n.root [as rootRenderFunc] (eval at i.B (http://localhost:8080/vendor/node_modules/nunjucks/browser/nunjucks.min.js:2:38002), <anonymous>:264:3)
    at n.i.getExported (http://localhost:8080/vendor/node_modules/nunjucks/browser/nunjucks.min.js:2:37712)
    at eval (eval at i.B (http://localhost:8080/vendor/node_modules/nunjucks/browser/nunjucks.min.js:2:38002), <anonymous>:21:5)
    at http://localhost:8080/vendor/node_modules/nunjucks/browser/nunjucks.min.js:2:35101
    at o (http://localhost:8080/vendor/node_modules/nunjucks/browser/nunjucks.min.js:2:34826)
    at http://localhost:8080/vendor/node_modules/nunjucks/browser/nunjucks.min.js:2:63436
(anonymous) @ module.js:96
(anonymous) @ environment.js:20
h.call @ browser-asap.js:48
u @ browser-raw.js:52
characterData (async)
r @ browser-raw.js:147
i @ browser-raw.js:16
u @ browser-asap.js:35
E @ environment.js:19
(anonymous) @ environment.js:495
(anonymous) @ VM190:22
(anonymous) @ environment.js:540
root @ VM194:264
i.getExported @ environment.js:538
(anonymous) @ VM190:21
(anonymous) @ environment.js:261
o @ environment.js:273
(anonymous) @ web-loaders.js:50
i.onreadystatechange @ web-loaders.js:74
XMLHttpRequest.send (async)
e.fetch @ web-loaders.js:88
e.getSource @ web-loaders.js:33
(anonymous) @ environment.js:283
e @ lib.js:310
n.asyncIter @ lib.js:316
i.getTemplate @ environment.js:267
(anonymous) @ VM190:19
(anonymous) @ environment.js:542
root @ VM193:32
i.getExported @ environment.js:538
(anonymous) @ VM190:16
(anonymous) @ environment.js:261
o @ environment.js:273
(anonymous) @ web-loaders.js:50
i.onreadystatechange @ web-loaders.js:74
XMLHttpRequest.send (async)
e.fetch @ web-loaders.js:88
e.getSource @ web-loaders.js:33
(anonymous) @ environment.js:283
e @ lib.js:310
n.asyncIter @ lib.js:316
i.getTemplate @ environment.js:267
(anonymous) @ VM190:14
(anonymous) @ environment.js:542
(anonymous) @ VM191:285
(anonymous) @ environment.js:542
root @ VM192:84
i.getExported @ environment.js:538
(anonymous) @ VM191:11
(anonymous) @ environment.js:261
o @ environment.js:273
(anonymous) @ web-loaders.js:50
i.onreadystatechange @ web-loaders.js:74
XMLHttpRequest.send (async)
e.fetch @ web-loaders.js:88
e.getSource @ web-loaders.js:33
(anonymous) @ environment.js:283
e @ lib.js:310
n.asyncIter @ lib.js:316
i.getTemplate @ environment.js:267
root @ VM191:9
i.getExported @ environment.js:538
(anonymous) @ VM190:11
(anonymous) @ environment.js:261
o @ environment.js:273
(anonymous) @ web-loaders.js:50
i.onreadystatechange @ web-loaders.js:74
XMLHttpRequest.send (async)
e.fetch @ web-loaders.js:88
e.getSource @ web-loaders.js:33
(anonymous) @ environment.js:283
e @ lib.js:310
n.asyncIter @ lib.js:316
i.getTemplate @ environment.js:267
root @ VM190:9
i.render @ environment.js:478
(anonymous) @ environment.js:314
(anonymous) @ environment.js:261
o @ environment.js:273
(anonymous) @ web-loaders.js:50
i.onreadystatechange @ web-loaders.js:74
XMLHttpRequest.send (async)
e.fetch @ web-loaders.js:88
e.getSource @ web-loaders.js:33
(anonymous) @ environment.js:283
e @ lib.js:310
n.asyncIter @ lib.js:316
i.getTemplate @ environment.js:267
i.render @ environment.js:308
(anonymous) @ module.js:94
getDom @ module.js:86
(anonymous) @ main.js:114
updateDom @ main.js:113
updateDom @ main.js:551
updateDom @ module.js:364
socketNotificationReceived @ MMM-Jast.js:14
(anonymous) @ module.js:250
(anonymous) @ socketclient.js:39
./node_modules/component-emitter/index.js.Emitter.emit @ index.js:145
emitEvent @ socket.js:253
onevent @ socket.js:240
MMSocket.self.socket.onevent @ socketclient.js:33
onpacket @ socket.js:204
(anonymous) @ index.js:21
./node_modules/component-emitter/index.js.Emitter.emit @ index.js:145
ondecoded @ manager.js:207
(anonymous) @ index.js:21
./node_modules/component-emitter/index.js.Emitter.emit @ index.js:145
add @ index.js:117
ondata @ manager.js:199
(anonymous) @ index.js:21
./node_modules/component-emitter/index.js.Emitter.emit @ index.js:145
onPacket @ socket.js:387
(anonymous) @ socket.js:196
./node_modules/component-emitter/index.js.Emitter.emit @ index.js:145
onPacket @ transport.js:103
onData @ transport.js:96
ws.onmessage @ websocket.js:108
Show 36 more frames

config.js

{
            module: "MMM-Jast",
            position: "bottom_bar",
            config: {
                maxWidth: "100%",
                updateIntervalInSeconds: 300,
                fadeSpeedInSeconds: 3.5, // Higher value: vertical -> faster // horizontal -> slower
                scroll: "horizontal", // One of ["none", "vertical", "horizontal"]
                useGrouping: false,
                currencyStyle: "code", // One of ["code", "symbol", "name"]
                showColors: true,
                showCurrency: true,
                showChangePercent: true,
                showChangeValue: false,
                showChangeValueCurrency: false,
                showPortfolioValue: false,
                showPortfolioGrowthPercent: false,
                showPortfolioGrowth: false,
                numberDecimalsValues: 2,
                numberDecimalsPercentages: 1,
                virtualHorizontalMultiplier: 2,
                stocks: [
                { name: "TESLA", symbol: "TSLA", quantity: 10 },
                { name: "APPLE", symbol: "APPL", quantity: 15 },
                { name: "CHEVRON", symbol: "CVX" }
            ]
        }
    },

Additional info

No response

jalibu commented 3 years ago

The problem is the Apple symbol. It is AAPL, not APPL. I know, that this is a bad user experience, with the UNDEFINED error instead of a meaningful message. I'll change that once I find the time for that.

jpiatt commented 3 years ago

Thanks! Fixed my config and now it works just fine!

jalibu commented 3 years ago

It only was a minor change. I just released a 2.5.1 version which should respond with a meaningful error message