Hi everyone,
Using node-red v1.0.3 with nodejs v10.
I've started to use the context from localFileSystem, for persistence.
I managed to use it and store items with global.set(...) and flow.set(...) inside function nodes.
The bug i've found is when i try to retrieve synchronously from the file contextStore. Using function node i have this:
//ASYNC - working
/*flow.get('count','file',function(err, myCount) {
if(err){
node.error(err, msg);
}else{
msg.payload=myCount;
node.send(msg);
}
});*/
//SYNC - not working
var a = flow.get('count','file');
msg.payload=a;
return msg;
And i get the following error:
12/12/2019, 15:03:10node: c5ed7f86.e463function : (error)
"Error: Callback must be a function"
I've tracked down the path into the following file from source: @node-red/runtime/lib/nodes/context/localfilesystem.js -> line 248
where it seems that its always expecting a callback function even if its sync:
LocalFileSystem.prototype.get = function(scope, key, callback) {
...
if(typeof callback !== "function"){
throw new Error("Callback must be a function");
}
...
Hope you guys can fix it shortly,
Cheers,
G.B.