-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
Environment:
- Node.js Version: 16.18.0
- Redis Server Version: 6.0.0
- Node Redis Version: 4.3.1
- Platform: Debian 10
We have a Redis managed instance in the IBM Cloud, version 6
I've created in this way the connection:
import { createClient } from "redis";
import l from "../logger.js";
class RedisClientWrapper {
constructor() {
this.connectionConfig = {
url: process.env.REDIS_URL,
socket: {
reconnectStrategy: (retries) => {
l.info(`Redis reconnect ${retries}`);
if (retries > 3) return new Error("Too many attemps");
return 0;
},
},
};
this.client = null;
this.state = "idle";
}
async initalize() {
try {
if (process.env.REDIS_URL.includes("appdomain.cloud")) {
const ca = Buffer.from(process.env.REDIS_CACERT, "base64").toString("utf-8");
this.connectionConfig.socket = Object.assign({}, this.connectionConfig, {
tls: true,
ca: ca,
});
}
this.client = createClient(this.connectionConfig);
} catch (e) {
l.error(`Redis create client error ---> ${e}`);
}
try {
await this.client.connect();
const foo = this.client.get("foo");
l.info(foo);
} catch (e) {
l.error(`Redis connet error ---> ${e.stack}`);
}
}
}
export default new RedisClientWrapper();
When i try to any simple operation this error occurs -> TypeError: stream.pause is not a function
This is the stacktrace
at new JSStreamSocket (node:internal/js_stream_socket:62:12)
at new TLSSocket (node:_tls_wrap:515:12)
at Object.connect (node:_tls_wrap:1632:19)
at RedisSocket._RedisSocket_createTlsSocket (/usr/src/app/node_modules/@redis/client/dist/lib/client/socket.js:201:21)
at /usr/src/app/node_modules/@redis/client/dist/lib/client/socket.js:162:101
at new Promise (<anonymous>)
at RedisSocket._RedisSocket_createSocket (/usr/src/app/node_modules/@redis/client/dist/lib/client/socket.js:160:12)
at RedisSocket._RedisSocket_connect (/usr/src/app/node_modules/@redis/client/dist/lib/client/socket.js:134:150)
at RedisSocket.connect (/usr/src/app/node_modules/@redis/client/dist/lib/client/socket.js:65:96)
at Commander.connect (/usr/src/app/node_modules/@redis/client/dist/lib/client/index.js:166:70)
What's wrong in my configuration? Some misaligned deps?