I am new to node-red and am trying to experiment with following code in a function node:
var ce = {}; ce.id = "a8fd123d-5ac6-44bb-a146-898959a1812e"; msg.payload = ce; return msg;
Except that I want to generate a new UUID for ce.id property. Not sure how to go about it. When I searched in the forum, there was a post from 2018. They seemed to solve this using hard-coded path for the uuid module. This is 2021. Not sure if there is a better way. I definitely don't want to hard code any paths to the modules.
Yes, if you have node-red 1.3.x you can enable functionExternalModules in your settings file....
functionExternalModules
if set to true, the Function node’s Setup tab will allow adding additional modules that will become available to the function. See Writing Functions for more information. Default: false.
I am getting following error:
19 Jun 11:24:02 - [error] [function:c8620f48.b1bad] Failed to load module : Error: Module not allowed
node_modules/@node-red/util/lib/log.js:94
19 Jun 11:24:02 - [error] [function:c8620f48.b1bad] Error: Function node failed to load external modules