Hi, How can I load or use external libraries to a function node?
I wanna use the "influx" node to my function. I read a lot of tutorials about it seems like it never worked to me. Hope you guys can help me.
This is my settings.js config:
And as per documentation, you can use this in function node via:
var INFLUX = global.get("influx")
var influxDB = new INFLUX.influxDB(influx_config)
influxDB.writePoints(msg.payload.data)
return msg;
That would be a correct approach (at least one way)
Therefore, the error you are getting, might be more about how the use of the module/the module it's self
Given the error, it would suggest you are trying to instantiate something that isn't a class - I don't use influx, so don't know its module (or exports)
Hi Collin,
Thanks for checking in, yes I know that, I actually using it for quite some time. How ever you cannot pass dynamically the name of the database in msg.db, you have to configure it on the influx node, in my case I need to pass it dynamically so I need to have customized function for it
I need to specify the DB outside the nodered platform. I don't want the user to open my nodered editor, so I need to create my own UI for this, and pass this parameter in nodered via runtime.
I actually tried the subflow environment and pass it to influx node config, but seems like there is a problem. I don't have choice but to do like this.
The same was as you did in a subflow that did not work, but not in a subflow. I imagine the reason it did not work was because it was in a subflow, are you using the latest version of node-red?