Redis Stuck on Get

Viewed 85

I dockerized my Node + Express + Postgres + Redis app.

It seems to work well, it is able to write in the database and to the redis cache. I am encountering issues though with the retrieval on redis cache.

It gets stuck in client.get (client is redis):

await client.get(collarId, (err, data) => {
}

I checked the persistency of redis, I was able to find dump.rdb and the new record can be seen there.

Here is my docker-compose for redis:

cache:
    container_name: cache
    image: 'redis:latest'
    restart: always
    ports:
      - "6379:6379"
    expose:
      - 6379
    command: redis-server --save 20 1 --loglevel warning --requirepass redis --appendonly yes
    volumes:
      - ./redis-vol:/data
    networks:
      - my-network

Any ways I can check why it is stuck on client.get? it works fine outside of the container.

Thanks!

1 Answers

Was able to get it to work!

Apparently the client must be created with legacyMode: true.

const redis = require('redis')

redis.createClient({
  url: process.env.REDIS_URL,
  legacyMode: true
})
Related