You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
did not support node-redis,
const redis = require("redis");
TypeError: client.evalsha is not a function
at Redlock._attemptOperationOnClient (/home/mason/project/epubpub/epub-search/node_modules/redlock/dist/cjs/index.js:362:49)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
const redLock = new Redlock([redisClient], {
// the expected clock drift; for more details
// see http://redis.io/topics/distlock
driftFactor: 0.01, // time in ms
// the max number of times Redlock will attempt
// to lock a resource before erroring
retryCount: 4,
// the time in ms between attempts
retryDelay: 50, // time in ms
redLock.on("error", (error) => {
// Ignore cases where a resource is explicitly marked as locked on a client.
if (error instanceof ResourceLockedError) {
return;
}
// Log all other errors.
console.error(error);
});
Hi, the problem is that older versions of redis supported all-lower-cased methods, but newer versions switched to camel casing. You should patch your redis client. Something like:
Hi, the problem is that older versions of redis supported all-lower-cased methods, but newer versions switched to camel casing. You should patch your redis client. Something like:
did not support node-redis,
const redis = require("redis");
TypeError: client.evalsha is not a function
at Redlock._attemptOperationOnClient (/home/mason/project/epubpub/epub-search/node_modules/redlock/dist/cjs/index.js:362:49)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
const redisClient = require("./redisClient");
const { default: Redlock, ResourceLockedError } = require("redlock");
const redLock = new Redlock([redisClient], {
// the expected clock drift; for more details
// see http://redis.io/topics/distlock
driftFactor: 0.01, // time in ms
// the max number of times Redlock will attempt
// to lock a resource before erroring
retryCount: 4,
// the time in ms between attempts
retryDelay: 50, // time in ms
// the max time in ms randomly added to retries
// to improve performance under high contention
// see https://www.awsarchitectureblog.com/2015/03/backoff.html
retryJitter: 25, // time in ms
});
redLock.on("error", (error) => {
// Ignore cases where a resource is explicitly marked as locked on a client.
if (error instanceof ResourceLockedError) {
return;
}
// Log all other errors.
console.error(error);
});
module.exports = redLock;
const config = require("../config");
const redis = require("redis");
const redisPort = config.redis.port;
const redisHost = config.redis.host;
const redisPass = config.redis.password;
let redisConfig = {
socket: {
host: redisHost,
port: redisPort,
},
password: redisPass,
};
const redisClient = redis.createClient(redisConfig);
redisClient.on("error", (err) => {
console.error("Error: %o ", err);
});
redisClient.on("connect", () => {
console.log("Connected to Redis");
});
redisClient.on("close", () => {
console.log("Connection to redis has closed");
});
redisClient.connect();
module.exports = redisClient;
The text was updated successfully, but these errors were encountered: