Registry / database / node-red-contrib-redis

node-red-contrib-redis

JSON →
library1.4.0jsnpmunverified

A Node-RED client for Redis that supports pub/sub, lists, Lua scripting, SSL, cluster, custom commands, and instance injection. Version 1.4.0 is the latest stable release as of 2025, with sporadic updates. It uses ioredis under the hood and provides multiple node types: redis-in (for blocking/non-blocking subscriptions), redis-out, redis-command (for arbitrary commands), and redis-queue. Unlike generic Redis libraries, it integrates directly with Node-RED's flow-based programming model, allowing connection reuse and per-config naming. The roadmap includes stream support and better validation, though development has slowed.

npm install node-red-contrib-redis
INSTALL
IMPORT
SIG · NODE-RED-CONTRIB-R
N
node-red-contrib-redis
databasejavascriptv1.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

redis-in
✓ Node-RED palette node (drag-and-drop), no manual import
Installed via npm, appears in Node-RED palette after refresh. No JavaScript import needed.
redis-out
✓ Node-RED palette node (drag-and-drop), no manual import
Same as redis-in; used for publishing or writing to Redis.
redis-command
✓ Node-RED palette node (drag-and-drop), no manual import
Used for executing arbitrary Redis commands with parameters.

Example Node-RED flow showing SET command using redis-command node. Requires a redis-server config node.

// No direct JavaScript API; all usage is via Node-RED flows. // Below is an example flow JSON you can import into Node-RED. // It demonstrates basic SET/GET via redis-command and pub/sub. [{"id":"1","type":"inject","z":"flow","name":"","topic":"","payload":"value","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":200,"wires":[["2"]]},{"id":"2","type":"redis-command","z":"flow","server":"4","command":"set","name":"","topic":"test","params":"[\"key\"]","paramsType":"json","payloadType":"json","block":false,"x":400,"y":200,"wires":[["3"]]},{"id":"3","type":"debug","z":"flow","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":600,"y":200,"wires":[]},{"id":"4","type":"redis-server","z":"","name":"My Redis","host":"localhost","port":"6379","db":"0","password":"","useTls":false,"tlsOptions":{}}]
Debug
Known issues
breakingv1.4.0 changed connection handling: now shares connection per config name, but can open new connections if 'block connection' option is set.
fix
Review flows: ensure connection blocking option matches expected behavior (block=true for dedicated connection).
affects: >=1.4.0
deprecatedThe redis-queue node is not documented but exists in code; may be removed in future versions.
fix
Use redis-out with appropriate commands (e.g., LPUSH) for queue patterns.
affects: >=0.2.0
gotchaParameters for redis-command must be JSON stringified in the 'params' field. Passing a plain string will cause errors.
fix
Ensure 'params' contains valid JSON array, e.g., ["key", "value"] as a JSON string.
affects: all
gotchaWhen using redis-in with blocking commands (e.g., BLPOP), the node will block the entire Node-RED event loop if timeout is not set properly.
fix
Set a reasonable timeout (e.g., 0 for no timeout, but avoid 0 in production; set a non-zero timeout in milliseconds).
affects: all
Errors
Common errors & fixes
Error: Connection to Redis failed. Check host and port.
Redis server not running or incorrect host/port in config node.
fix
Ensure Redis is running: `redis-server`. Verify host (localhost) and port (6379) in the redis-server config node.
Error: ERR wrong number of arguments for 'set' command
The 'params' field does not contain proper JSON array matching command arguments.
fix
For SET command, params should be: ["key", "value"] as JSON (e.g., ["mykey","myvalue"]).
TypeError: msg.payload is not iterable
Payload sent to redis-out is not an array when command expects multiple arguments.
fix
Ensure msg.payload is an array of arguments for commands like RPUSH (e.g., payload: ["list", "elem1", "elem2"]).
Upgrade
Version history
1.4.0latest on npm
Audit
Dependencies
ioredisrequiredCore dependency for all Redis interactions (connections, commands, pub/sub)
Agent activity
6 hits · last 30 days
node
6
Resources
node-red-contrib-redis — npm install node-red-contrib-redis · libregistry