zinen / node-red-contrib-nordpool-api-plus

7 stars 5 forks source link

Error after upgrading to 4.5.0 #23

Closed qabi closed 10 months ago

qabi commented 11 months ago

Occurs for call with timestamp set. Crashed Node-Red

2023/12/14 21:44:12 stdout      at processImmediate (node:internal/timers:466:21)
2023/12/14 21:44:12 stdout      at Immediate.<anonymous> (/usr/src/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:815:21)
2023/12/14 21:44:12 stdout      at deliverMessageToDestination (/usr/src/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:799:40)
2023/12/14 21:44:12 stdout      at nordpoolAPIPlus.Node.receive (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:494:10)
2023/12/14 21:44:12 stdout      at nordpoolAPIPlus.Node.emit (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:186:25)
2023/12/14 21:44:12 stdout      at nordpoolAPIPlus.Node._emitInput (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:202:11)
2023/12/14 21:44:12 stdout      at Object.trigger (/usr/src/node-red/node_modules/@node-red/util/lib/hooks.js:166:13)
2023/12/14 21:44:12 stdout      at /usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:210:26
2023/12/14 21:44:12 stdout      at nordpoolAPIPlus._inputCallback (/data/node_modules/node-red-contrib-nordpool-api-plus/nordpool-api-plus.js:36:24)
2023/12/14 21:44:12 stdout  14 Dec 21:44:12 - [error] TypeError: date.toISOString is not a function 
qabi commented 11 months ago

Seems to be caused by no selection in the "Action on input" field, after upgrading (default value).

From looking at the code, date is assigned a string in line 28, and then accessed as a Date object in line 36. (When node.action is 'dayAhead' and msg.date is defined).

zinen commented 11 months ago

I'll look into it

zinen commented 11 months ago

Should be fixed in v4.5.1