question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: stream.pause is not a function

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
GiboMaccommented, Nov 8, 2022

found it! misconfiguration for the connection config 😫

0reactions
leibalecommented, Nov 9, 2022

@GiboMac if you can elaborate a little bit more that might help the next person that will get this error… thanks 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - Stream.pause is not a function when uploading file to ...
I get the error stream.pause is not a function which is called by the azure-storage at the start of the upload because the...
Read more >
TypeError: stream.pause is not a function #25553 - GitHub
It sounds like an object that is not a proper stream is being passed to node's API. Judging by #25552 it's probably a...
Read more >
[Solved]-Stream.pause is not a function when uploading file to ...
[Solved]-Stream.pause is not a function when uploading file to stream to azure-node.js ... The issue is that a buffer do not correspond with...
Read more >
Node.js Stream readable.pause() Method - GeeksforGeeks
Parameters: This method does not accept any parameters. Return Value: If this method is used then the reading of data is paused at...
Read more >
fs.ReadStream.pause JavaScript and Node.js code examples
we are overflowing the destination, we should pause srcStream.pause() ... we should pause srcStream.pause() // we will resume when the destination stream is ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found