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.
haraka-plugin-redis
✓ this.inherits('redis') // within a Haraka plugin
✗ const redis = require('haraka-plugin-redis')
This is a Haraka plugin, not a standalone module. Use inheritance in your Haraka plugin.
server.notes.redis
✓ if (server.notes.redis) { server.notes.redis.hGetAll(...) }
✗ server.notes.redis = require('redis').createClient()
Shared Redis handle is automatically set by the plugin. Do not manually create your own.
register_hook('init_master', ...)
✓ this.register_hook('init_master', 'init_redis_plugin')
✗ this.register_hook('init_master', this.init_redis_plugin)
The hook callback is specified as a string (method name), not a function reference.
Demonstrates inheriting the redis plugin, registering init hooks, and using the shared Redis client in a hook.
// In your Haraka plugin file (e.g., my-plugin.js)
exports.register = function () {
this.inherits('redis')
this.register_hook('init_master', 'init_redis_plugin')
this.register_hook('init_child', 'init_redis_plugin')
}
exports.hook_rcpt = function (next, connection) {
if (connection.server.notes.redis) {
connection.server.notes.redis.hGetAll('somekey', function (err, data) {
if (err) return next()
// process data
next()
})
} else {
next()
}
}
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'hGetAll')
server.notes.redis is undefined because Redis connection is not yet established or failed.
fixEnsure redis plugin is loaded and wait for init_child hook before using redis in hooks.
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
Redis server is not running or unreachable.
fixStart Redis server or check redis.ini configuration for correct host/port.
Audit
Dependencies
harakarequiredCore SMTP server that this plugin extends
redisrequiredNode.js Redis client library