Registry / data / node-red-contrib-uuid

node-red-contrib-uuid

JSON →
library0.0.4-rc-1jsnpmunverified

node-red-contrib-uuid is a Node-RED node designed for the simple and fast generation of RFC4122 compliant Universally Unique Identifiers (UUIDs) within Node-RED flows. It leverages the robust `uuid` npm package internally to ensure standard-compliant and cryptographically strong UUIDs. As of version 0.0.4-rc-1, it is in a release candidate stage, indicating active development and refinement. Node-RED contrib nodes typically follow an independent release cadence, often tied to feature enhancements or updates in their underlying dependencies like the `uuid` library. Its primary differentiator is providing a drag-and-drop solution for UUID generation directly within the Node-RED visual programming environment, abstracting the complexities of the underlying `uuid` library for flow developers.

npm install node-red-contrib-uuid
INSTALL
IMPORT
SIG · NODE-RED-CONTRIB-U
N
node-red-contrib-uuid
datajavascriptv0.0.4-rc-1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

v4
import { v4 as uuidv4 } from 'uuid';
import uuidv4 from 'uuid/v4'; // Deprecated since uuid@7, removed default export import uuid from 'uuid'; console.log(uuid.v4()); // Default export removed in uuid@8+
These imports are for the underlying 'uuid' library, used by developers building Node-RED nodes or directly in a Node-RED Function node's 'Setup' tab. Users of 'node-red-contrib-uuid' interact with it visually in the Node-RED editor, not via JavaScript imports.
v1
import { v1 as uuidv1 } from 'uuid';
const uuidv1 = require('uuid/v1'); // Deprecated deep import, use named exports
For CommonJS environments or older Node-RED Function nodes (pre-v1.0 or without 'Setup' tab module loading), you might see `const { v1 } = require('uuid');`. Ensure 'uuid' package is installed and accessible via `functionGlobalContext` or the Function node's module setup.
randomUUID
import { randomUUID } from 'node:crypto';
import { v4 } from 'uuid'; // While v4 is good, node:crypto.randomUUID is often faster in Node.js >=14.17.0/15.6.0.
For Node.js environments (including Node-RED) version 14.17.0+ or 15.6.0+, `crypto.randomUUID()` is a native, highly performant option for v4 UUIDs. This is an alternative to the 'uuid' package for purely random UUID generation within Function nodes.

This Node-RED flow demonstrates basic UUID generation. It uses an Inject node to trigger the UUID node, which then generates a Version 4 UUID and outputs it to the debug sidebar.

[{"id":"435a2d67.123456","type":"inject","z":"a1b2c3d4.567890","name":"Trigger UUID","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":100,"wires":[["e8f9g0h1.234567"]]},{"id":"e8f9g0h1.234567","type":"uuid","z":"a1b2c3d4.567890","name":"Generate UUID","version":"v4","outputProperty":"payload","x":340,"y":100,"wires":[["210fe3dc.987654"]]},{"id":"210fe3dc.987654","type":"debug","z":"a1b2c3d4.567890","name":"Show UUID","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":540,"y":100,"wires":[]}]
Debug
Known issues
breakingThe underlying `uuid` library has undergone significant breaking changes across major versions (v7, v8, v9, v10, v11, v14). These include dropping Node.js 10.x, 12.x, 14.x, 18.x support, removing the default export, deprecating deep imports (e.g., `uuid/v4`), and transitioning to ESM-only in recent versions. While `node-red-contrib-uuid` abstracts this, maintainers must ensure the internal `uuid` dependency version is compatible with Node-RED's runtime Node.js version and handle `uuid`'s breaking changes.
fix
Node-RED users: Ensure your Node-RED instance uses a supported Node.js version. Node-RED developers/maintainers: Regularly update the `uuid` dependency to its latest stable version, carefully reviewing its changelog for breaking changes and adapting import/usage patterns if necessary, especially regarding ESM and CJS compatibility for Node-RED's runtime.
affects: >=0.0.1
deprecatedOlder versions of the `uuid` library (specifically `uuid@3.x`) were deprecated due to their reliance on `Math.random()` for certain UUID versions, which is known to be cryptographically insecure. Using such versions can lead to predictable or duplicate UUIDs in sensitive applications.
fix
Ensure `node-red-contrib-uuid` (or any custom Function node code using `uuid`) depends on `uuid` version 7 or higher. Check the `node-red-contrib-uuid`'s `package.json` for its `uuid` dependency version or update Node-RED and its modules to ensure modern, secure UUID generation.
affects: <0.0.4
gotchaNode-RED contrib nodes, including `node-red-contrib-uuid`, might not immediately appear in the palette after installation if Node-RED isn't restarted or if there are package installation issues. Errors during Node-RED startup or palette loading can also prevent nodes from showing up.
fix
After installing (`npm install node-red-contrib-uuid` in your Node-RED user directory, typically `~/.node-red`), always restart your Node-RED instance. If the issue persists, check the Node-RED startup logs for errors related to the node or run `npm audit` in your Node-RED user directory to identify dependency problems.
affects: >=0.0.1
Errors
Common errors & fixes
Error: Cannot find module 'node-red-contrib-uuid'
The package was not installed correctly in the Node-RED user directory or Node-RED was not restarted after installation.
fix
Navigate to your Node-RED user directory (usually `~/.node-red`) and run `npm install node-red-contrib-uuid`. Then restart your Node-RED instance (e.g., `node-red-restart` or `pm2 restart node-red`).
npm WARN deprecated uuid@X.Y.Z: Please upgrade to version 7 or higher.
The `node-red-contrib-uuid` package, or another dependency, is using an outdated and potentially insecure version of the `uuid` library.
fix
While `node-red-contrib-uuid` maintains its own dependencies, this warning suggests its internal `uuid` version might be old. Monitor for updates to `node-red-contrib-uuid`. If the warning persists and you're using `uuid` directly in a Function node, update your `uuid` dependency to `@latest` (version 7 or higher) in your Node-RED `package.json` and ensure it's accessible.
ReferenceError: uuidv4 is not defined
Attempting to use `uuid` in a Node-RED Function node without properly declaring it as an external module.
fix
In the Function node's 'Setup' tab, add 'uuid' as a module (e.g., 'uuidv4' for the variable name, 'uuid' for the module name). Then in your function code, you can use `const { v4: uuidv4 } = global.get('uuidv4')` or simply `const uuidv4 = require('uuid').v4;` if configured via `settings.js`.
Upgrade
Version history
0.0.4-rc-1latest on npm
Audit
Dependencies
uuidrequiredCore library for generating RFC4122 compliant UUIDs.
node-redrequiredPeer dependency as it is a Node-RED contribution node.
Agent activity
7 hits · last 30 days
node
6
Resources