Skip to content

TypeError when "DENIED Redis is running in protected mode ..." #2417

@JohnnyRacer

Description

@JohnnyRacer

Description

I am getting a very strange type error everytime I try to use docker compose up to launch any script that connects to redis with the following error message:

redis-test /node_modules/@redis/client/dist/lib/client/commands-queue.js:62
redis-test                 const { resolve, reject } = __classPrivateFieldGet(this, _RedisCommandsQueue_waitingForReply, "f").shift();
redis-test                         ^
redis-test 
redis-test TypeError: Cannot destructure property 'resolve' of '__classPrivateFieldGet(...).shift(...)' as it is undefined.
redis-test     at Object.onReply (/node_modules/@redis/client/dist/lib/client/commands-queue.js:62:25)
redis-test     at RESP2Decoder.write (/node_modules/@redis/client/dist/lib/client/RESP2/decoder.js:119:26)
redis-test     at RedisCommandsQueue.onReplyChunk (/node_modules/@redis/client/dist/lib/client/commands-queue.js:154:72)
redis-test     at RedisSocket.<anonymous> (/node_modules/@redis/client/dist/lib/client/index.js:388:84)
redis-test     at RedisSocket.emit (node:events:512:28)
redis-test     at Socket.<anonymous> (/node_modules/@redis/client/dist/lib/client/socket.js:202:42)
redis-test     at Socket.emit (node:events:512:28)
redis-test     at addChunk (node:internal/streams/readable:324:12)
redis-test     at readableAddChunk (node:internal/streams/readable:297:9)
redis-test     at Readable.push (node:internal/streams/readable:234:10)
redis-test 
redis-test Node.js v19.6.1
redis-test exited with code 1

This error does not happen when I connect to redis using the node.js REPL without docker.

This is the docker-compose.yml file I am using to create the redis container:

  redis:
    image: redis/redis-stack:latest
    ports:
      - 6379:6379
    command: ["redis-server", "--appendonly", "yes"]
    volumes:
      - redis-data:/data

And the code I am using in node.js to connect to redis

import { createClient } from "redis";
(async function () {
    const rdb = createClient({
        url: 'redis://redis:6379'
        });
   
    await rdb.connect();
})();

Node.js Version

19.6.1

Redis Server Version

6.2.8

Node Redis Version

4.6.4

Platform

Linux

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions