🎉 Node-RED 0.19 released

Great work and my W10 dev machine (with non-standard install) upgraded with no effort at all.

One small question, the release notes mention that you can:

It also supports having more than one store configured in the runtime, so you can choose where each piece of context data is stored. For example, you may want a non-persistent store for some values and a persistent store for others.

But the documentation doesn't mention how to do that?

1 Like

Yes, I was looking for the same Julian.....

@Paul-Reed @TotallyInformation you configure multiple stores by having multiple configs listed:

contextStorage: {
   default: {
       module: "localfilesystem"
   },
   memoryOnly: {
       module: "memory"
   }
},

Then, as per the docs you can use either default or memoryOnly as the store name argument of context.get/set. Also, once you have multiple stores configured, the TypedInput has an extra drop-down to pick the store to use.

Will update the docs.

3 Likes

Good morning

I have upgraded to V0.19 with the script, then I have edited settings.js as saw on a previous post in order to have persistent data variables:


// The `https` setting requires the `fs` module. Uncomment the following
// to make it available:
//var fs = require("fs");

module.exports = {
    // the tcp port that the Node-RED web server is listening on
    uiPort: process.env.PORT || 1880,

// enable persistent storage
//
 contextStorage: {
 default: {
 module: "localfilesystem"
 }
 },




    // By default, the Node-RED UI accepts connections on all IPv4 interfaces.
    // The following property can be used to listen on a specific interface. For
    // example, the following would only allow connections from the local machine.
    //uiHost: "127.0.0.1",

    // Retry time in milliseconds for MQTT connections
    mqttReconnectTime: 15000,

Doing that node red restart frequently and I have no idea why, on syslog I have:


Aug 15 08:45:40 raspberrypi Node-RED[7822]:   _topic: '/ESP-4/switch2/Switch',
Aug 15 08:45:40 raspberrypi Node-RED[7822]:   _msgid: 'b08c1fd2.f4e05' }
Aug 15 08:45:42 raspberrypi Node-RED[7822]: { topic: 'state', payload: 1, _msgid: '8630bf3b.a6a51' }
Aug 15 08:45:47 raspberrypi Node-RED[7822]: { _msgid: '9f2e2bf9.972118', topic: 'state', payload: 0$
Aug 15 08:46:48 raspberrypi systemd[1]: Stopping Node-RED graphical event wiring tool...
Aug 15 08:46:49 raspberrypi Node-RED[7822]: 15 Aug 08:46:49 - [error] [arduino-board:6aa72d72.407bf$
Aug 15 08:46:57 raspberrypi systemd[1]: Stopped Node-RED graphical event wiring tool.
Aug 15 08:46:57 raspberrypi systemd[1]: Started Node-RED graphical event wiring tool.
Aug 15 08:47:13 raspberrypi Node-RED[8237]: 15 Aug 08:47:13 - [warn] Projects disabled : set editor$
Aug 15 08:47:13 raspberrypi Node-RED[8237]: 15 Aug 08:47:13 - [warn]
Aug 15 08:47:13 raspberrypi Node-RED[8237]: -------------------------------------------------------$
Aug 15 08:47:13 raspberrypi Node-RED[8237]: Your flow credentials file is encrypted using a system-$
Aug 15 08:47:13 raspberrypi Node-RED[8237]: If the system-generated key is lost for any reason, you$
Aug 15 08:47:13 raspberrypi Node-RED[8237]: file will not be recoverable, you will have to delete i$
Aug 15 08:47:13 raspberrypi Node-RED[8237]: your credentials.
Aug 15 08:47:13 raspberrypi Node-RED[8237]: You should set your own key using the 'credentialSecret$
Aug 15 08:47:13 raspberrypi Node-RED[8237]: your settings file. Node-RED will then re-encrypt your $
Aug 15 08:47:13 raspberrypi Node-RED[8237]: file using your chosen key the next time you deploy a c$
Aug 15 08:47:13 raspberrypi Node-RED[8237]: -------------------------------------------------------$
Aug 15 08:47:21 raspberrypi Node-RED[8237]: (node:8237) MaxListenersExceededWarning: Possible Event$
Aug 15 08:47:21 raspberrypi Node-RED[8237]: { topic: 'state', payload: 0, _msgid: 'c2eb49e6.94f058'$
Aug 15 08:47:22 raspberrypi Node-RED[8237]: { topic: 'state', payload: '1', _msgid: 'a2710b4d.eef13$
Aug 15 08:47:22 raspberrypi Node-RED[8237]: { topic: 'state', payload: '1', _msgid: '75c31871.b25d8$
Aug 15 08:47:22 raspberrypi Node-RED[8237]: { topic: 'state', payload: 1, _msgid: 'a2710b4d.eef138'

If I comment with // the mentioned lines the my systems is stable again with no more issues.

Any idea?

It restarts me continiously

Aug 15 09:11:03 raspberrypi Node-RED[10040]: 15 Aug 09:11:03 - [error] [file:data file temp] failed$
Aug 15 09:11:03 raspberrypi Node-RED[10040]: 15 Aug 09:11:03 - [error] [file:data file temp] failed$
Aug 15 09:11:19 raspberrypi Node-RED[10040]: 15 Aug 09:11:19 - [red] Uncaught Exception:
Aug 15 09:11:19 raspberrypi Node-RED[10040]: 15 Aug 09:11:19 - TypeError: Converting circular struc$
Aug 15 09:11:19 raspberrypi Node-RED[10040]:     at JSON.stringify (<anonymous>)
Aug 15 09:11:19 raspberrypi Node-RED[10040]:     at /usr/lib/node_modules/node-red/red/runtime/node$
Aug 15 09:11:19 raspberrypi Node-RED[10040]:     at Array.forEach (<anonymous>)
Aug 15 09:11:19 raspberrypi Node-RED[10040]:     at LocalFileSystem.self._flushPendingWrites (/usr/$
Aug 15 09:11:19 raspberrypi Node-RED[10040]:     at Timeout._onTimeout (/usr/lib/node_modules/node-$
Aug 15 09:11:19 raspberrypi Node-RED[10040]:     at ontimeout (timers.js:498:11)
Aug 15 09:11:19 raspberrypi Node-RED[10040]:     at tryOnTimeout (timers.js:323:5)
Aug 15 09:11:19 raspberrypi Node-RED[10040]:     at Timer.listOnTimeout (timers.js:290:5)
Aug 15 09:11:19 raspberrypi systemd[1]: nodered.service: Main process exited, code=exited, status=1$
Aug 15 09:11:19 raspberrypi systemd[1]: nodered.service: Unit entered failed state.
Aug 15 09:11:19 raspberrypi systemd[1]: nodered.service: Failed with result 'exit-code'.
Aug 15 09:11:19 raspberrypi systemd[1]: nodered.service: Service hold-off time over, scheduling res$
Aug 15 09:11:19 raspberrypi systemd[1]: Stopped Node-RED graphical event wiring tool.
Aug 15 09:11:19 raspberrypi systemd[1]: Started Node-RED graphical event wiring tool.
Aug 15 09:11:33 raspberrypi Node-RED[10581]: 15 Aug 09:11:33 - [warn] Projects disabled : set edito$
Aug 15 09:11:34 raspberrypi Node-RED[10581]: 15 Aug 09:11:34 - [warn]
Aug 15 09:11:34 raspberrypi Node-RED[10581]: ------------------------------------------------------$
Aug 15 09:11:34 raspberrypi Node-RED[10581]: Your flow credentials file is encrypted using a system$
Aug 15 09:11:34 raspberrypi Node-RED[10581]: If the system-generated key is lost for any reason, yo$
Aug 15 09:11:34 raspberrypi Node-RED[10581]: file will not be recoverable, you will have to delete $
Aug 15 09:11:34 raspberrypi Node-RED[10581]: your credentials.
Aug 15 09:11:34 raspberrypi Node-RED[10581]: You should set your own key using´´´


another one:
``
Aug 15 09:12:44 raspberrypi Node-RED[10581]: 15 Aug 09:12:44 - [red] Uncaught Exception:
Aug 15 09:12:44 raspberrypi Node-RED[10581]: 15 Aug 09:12:44 - TypeError: Converting circular struc$
Aug 15 09:12:44 raspberrypi Node-RED[10581]:     at JSON.stringify (<anonymous>)
Aug 15 09:12:44 raspberrypi Node-RED[10581]:     at /usr/lib/node_modules/node-red/red/runtime/node$
Aug 15 09:12:44 raspberrypi Node-RED[10581]:     at Array.forEach (<anonymous>)
Aug 15 09:12:44 raspberrypi Node-RED[10581]:     at LocalFileSystem.self._flushPendingWrites (/usr/$
Aug 15 09:12:44 raspberrypi Node-RED[10581]:     at Timeout._onTimeout (/usr/lib/node_modules/node-$
Aug 15 09:12:44 raspberrypi Node-RED[10581]:     at ontimeout (timers.js:498:11)
Aug 15 09:12:44 raspberrypi Node-RED[10581]:     at tryOnTimeout (timers.js:323:5)
Aug 15 09:12:44 raspberrypi Node-RED[10581]:     at Timer.listOnTimeout (timers.js:290:5)
Aug 15 09:12:44 raspberrypi systemd[1]: nodered.service: Main process exited, code=exited, status=1$
Aug 15 09:12:44 raspberrypi systemd[1]: nodered.service: Unit entered failed state.
Aug 15 09:12:44 raspberrypi systemd[1]: nodered.service: Failed with result 'exit-code'.
Aug 15 09:12:44 raspberrypi systemd[1]: nodered.service: Service hold-off time over, scheduling res$
Aug 15 09:12:44 raspberrypi systemd[1]: Stopped Node-RED graphical event wiring tool.
Aug 15 09:12:44 raspberrypi systemd[1]: Started Node-RED graphical event wiring tool.
Aug 15 09:12:59 raspberrypi Node-RED[10742]: 15 Aug 09:12:59 - [warn] Projects disabled : s

Thanks in advance

@davidcgu that is interesting... what exactly are you writing to context? It appears you have an object with a circular reference in it - which cannot be JSON encoded so cannot be persisted properly. That isn't ideal, but we should handle it more gracefully.

Pufs an object with a circular reference in it? I have no idea what does that means or what could it be..... could be something with an accent like "salón" or similar that crash it?

Just to know what I'm looking for.

This is what I see listed:

AC_dormitorio	
"off"
AC_salon	
"off"
PIR_bany	
"no"
PIR_ducha	
"no"
PIR_entrada	
"no"
PIR_sofa	
"si"
PIR_tv	
"no"
TV	
"off"
ac_dormitorio_apagar	
"offtime 0:00"
ac_dormitorio_encender	
"ontime 0:00"
ac_dormitorio_programacion	
"suspended true"
ac_dormitorio_temperatura	
23
ac_salon_apagar	
"offtime 0:00"
ac_salon_encender	
"ontime 0:00"
ac_salon_programacion	
"suspended true"
ac_salon_temperatura	
21
auto_baño	
"on"
auto_salon	
"on"
baseIPandRange	
"192.168.1.1-255"
bloqueo	
"unlocked"
cam1-switch	
"true"
cam2-switch	
"true"
codigo_alarma	
"bloqueado"
contador	
"undefined"
date1	
"mié. 15 ago."
date2	
" jul. 18"
date3	
"mié. 15 ago. 10:17:21"
date_day	
"miércoles"
delay1	
15000
delay2	
180000
delay3	
30000
delay4	
0
delay5	
900000
delay6	
300000
delay7	
4000
esp_release	
"mega-20180815"
estado_alarma	
"desarmado"
etdh_version	
"v0.1.9"
lcd	
"off"
log_enable	
"activar"
luz_azul	
"no"
luz_baño	
"no"
luz_cocina	
"no"
luz_dormitorio	
"no"
luz_entrada	
"no"
luz_pasillo	
"no"
luz_salon	
6
luz_sofa	
"no"
luz_tv	
"no"
modo_nocturno	
"no"
modo_nocturno_baño	
"no"
offset1	
0
offset2	
0
offset3	
0
offset4	
0
persiana_dormitorio_bajar	
"offtime 0:00"
persiana_dormitorio_domingo	
"false"
persiana_dormitorio_estado	
"bajar"
persiana_dormitorio_jueves	
"false"
persiana_dormitorio_lunes	
"false"
persiana_dormitorio_martes	
"false"
persiana_dormitorio_miercoles	
"false"
persiana_dormitorio_programacion	
"suspended true"
persiana_dormitorio_sabado	
"false"
persiana_dormitorio_subir	
"ontime 0:00"
persiana_dormitorio_viernes	
"false"
persiana_salon_bajar	
"offtime 0:00"
persiana_salon_domingo	
"false"
persiana_salon_estado	
"parar"
persiana_salon_jueves	
"false"
persiana_salon_lunes	
"false"
persiana_salon_martes	
"false"
persiana_salon_miercoles	
"false"
persiana_salon_programacion	
"suspended true"
persiana_salon_sabado	
"false"
persiana_salon_subir	
"ontime 0:00"
persiana_salon_viernes	
"false"
plug-1_apagar	
"offtime 0:00"
plug-1_encender	
"ontime 0:00"
plug-1_programacion	
"suspended true"
plug-2_apagar	
"offtime 0:00"
plug-2_encender	
"ontime 0:00"
plug-2_programacion	
"suspended true"
plug-3_apagar	
"offtime 0:00"
plug-3_encender	
"ontime 0:00"
plug-3_programacion	
"suspended true"
puerta_abierta	
"no"
restart	
"off"
return	
"true"
salto_termico_dormitorio	
0
salto_termico_salon	
0
seguro_puerta	
"entrado"
sonido	
"no"
tas_release	
"6.1.1"
una_vez_dia	
"no"

   
``

Regards

A circular reference is where you have an object with a property that points back to itself.

For example:

var thisObject = { myProperty: thisObject};

There is no way to JSON encode that object.

So the question is, in your flows, are you storing any complex objects into context?

Originally not, I was storing all the variables in a redundant way every 4 seconds and restoring them 3 sec after deploy/restart and was running fine.

I'm trying to realize how can I search for what is the root cause, should be o some of the listed variables from the list I posted right? something should be making like a loop?

Thanks for your time Knolleary

Where did you get that list from? If it is from the context data sidebar? Remember the error was thrown trying to save something to context... so it may not appear on the list of things you have saved in context.

You're looking for anywhere your flow is saving an object other than a simple string or number.

I have a fix for this locally - just doing some more testing on it before we release 0.19.1 later today.

This list is from the context data side bar, previously I had node-red-contrib-contextbrowser but after upgrading node red I have uninstalled this node from the palette.

I will never say never but I think I'm only storing numbers & strings nothing else,

Previously as said I was storing all the variables on a single file on a very similar way that was shown on this tutorial: https://www.youtube.com/watch?v=JYQXF9JlOsg&t=554s with the change that I was storing every 4 sec and restoring the variables 3 sec after restart that was what for me was working fine, but this function was on a single tab that I have directly disabled after upgrade,

I will try to look deeper to see if I'm able to find something but I'm almost sure that I'm not trying to store any object.

If I find anything will let you know otherwise will disable this functionality for now and will upgrade later on to 0.19.1 and will let you know at any case the results.

Much appreciated boss :wink:

Played with new features of 0.19 and something went really wrong with GIT. Error was fatal for Node-RED but unfortunately I didn't copy the error then.
But after this I cant start it again with localfilesystem enabled. If i disable it from settings.js, node-RED starts without any problems.


Welcome to Node-RED
===================

15 Aug 13:47:44 - [info] Node-RED version: v0.19.0
15 Aug 13:47:44 - [info] Node.js  version: v8.11.3
15 Aug 13:47:44 - [info] Windows_NT 10.0.14393 x64 LE
15 Aug 13:50:53 - [info] Loading palette nodes
15 Aug 13:50:54 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
15 Aug 13:50:55 - [info] Dashboard version 2.9.6 started at /ui
15 Aug 13:50:55 - [warn] ------------------------------------------------------
15 Aug 13:50:55 - [warn] [node-red/tail] Not currently supported on Windows.
15 Aug 13:50:55 - [warn] ------------------------------------------------------
15 Aug 13:50:55 - [info] Settings file  : \Users\endele\.node-red\settings.js
15 Aug 13:50:55 - [info] Context store  : 'default' [module=localfilesystem]
(node:9268) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'substring' of undefined
   at C:\Users\endele\AppData\Roaming\npm\node_modules\node-red\red\runtime\nodes\context\localfilesystem.js:148:42
   at Array.forEach (<anonymous>)
   at C:\Users\endele\AppData\Roaming\npm\node_modules\node-red\red\runtime\nodes\context\localfilesystem.js:141:19
   at <anonymous>
(node:9268) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:9268) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
15 Aug 13:50:55 - [info] Server now running at http://127.0.0.1:1880/```
1 Like

@hotNipi Odd - can you please share with me a complete directory listing of C:\Users\endele\.node-red\context and any subdirectories?

global\global.json
That's all.
I stored some variables only in global.context and it produced and stored perfectly valid JSON

I looked at localfilesystem.js and I found that file name splitting is done directly on part of file path

var parts = file.split("/");

Shouldn't it be done using path.sep ?

Hi,

I'm using Change node, and I save info on a variable on flow or global context, but in the next node, the info gone! There is a difference way to use it form now on, in the new version?

Can you share an example flow that demonstrates what you mean?

Like this:

[{"id":"a554707f.78b6f","type":"http in","z":"40140b35.4cbcf4","name":"","url":"/message","method":"get","upload":false,"swaggerDoc":"","x":130,"y":160,"wires":[["5ad3aaae.666f94"]]},{"id":"5ad3aaae.666f94","type":"change","z":"40140b35.4cbcf4","name":"","rules":[{"t":"set","p":"text","pt":"flow","to":"req.query.text","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":230,"y":220,"wires":[["dd653bf9.1dea98","a7fb7c9d.6f6ce"]]},{"id":"f54f0ee3.5d398","type":"debug","z":"40140b35.4cbcf4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":550,"y":120,"wires":[]},{"id":"dd653bf9.1dea98","type":"http response","z":"40140b35.4cbcf4","name":"","statusCode":"","headers":{},"x":540,"y":300,"wires":[]},{"id":"a7fb7c9d.6f6ce","type":"function","z":"40140b35.4cbcf4","name":"","func":"msg.payload = context.flow.text;\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":160,"wires":[["f54f0ee3.5d398"]]}]

Your Function node is using the old syntax for using context:

msg.payload = context.flow.text;

It should be doing:

msg.payload = flow.get("text");

I just tested your flow on 0.18.7 and it does not work there either for the same reason. What version of Node-RED were you using that on?

In other words, as far as I can see (so far...) this is not a change in behaviour with 0.19.

1 Like

Hi Nick,

I got it! Yes, This issue happened when I sed the new version.

Thanks!!

What version were you using before? I need to know if we have broken something here.

Very old one! 0.15 (I think)