node-redis icon indicating copy to clipboard operation
node-redis copied to clipboard

Getting Error for Heroku Redis Addon Connection After Upgrading Redis NPM Version to Latest (4.6.7)

Open versa-dev opened this issue 2 years ago • 6 comments

Description

I am maintaining express.js app on Heroku. Because Heroku doesn't support Heroku Redis 4 & 5 soon, I have upgraded the Heroku Redis addon to 7.0, and also upgrade the redis npm module in my codebase of app to latest version (4.6.7). After that the app has been broken, and I am getting following error:

Error accepting a client connection: error:1408F10B:SSL routines:ssl3_get_record:wrong version number

This code snippet is my redis config file:

import * as Redis from 'redis'
import { REDIS_CONNECTION } from './../../constants';

const url = REDIS_CONNECTION;

export const createRedisClient = () => {
  return Redis.createClient({
    url,
    socket: {
      tls: true,
      rejectUnauthorized: false,
    },
  })
};

Node.js Version

16.14.2

Redis Server Version

7.0.11

Node Redis Version

4.6.7

Platform

No response

Logs

Error accepting a client connection: error:1408F10B:SSL routines:ssl3_get_record:wrong version number

versa-dev avatar Jun 19 '23 14:06 versa-dev

Same here. I just upgraded from Mini plan to Premium-0 and I am getting a similar error although without SSL part Error accepting a client connection: (null)

qaasimahmad avatar Jul 19 '23 04:07 qaasimahmad

I got it to work. For me, I upgraded to Premium-0 and for that and others in higher, tls must be enabled in the redis client connection.

qaasimahmad avatar Jul 19 '23 07:07 qaasimahmad

Hi @qaasimahmad , I am facing simler issue and my sbcription is already Premium-0? any suggestion? should i go for higher sbcription ?

Akhil1304 avatar Sep 07 '23 18:09 Akhil1304

HI @Akhil1304 just ensure that tls is enabled in your redis client connection code.

qaasimahmad avatar Sep 07 '23 20:09 qaasimahmad

So you client connection code should have a block like this

client = new Redis(redisUrl, {
          maxRetriesPerRequest: null,
          enableReadyCheck:     false,
          tls:                  {
            rejectUnauthorized: false
          }
        }

qaasimahmad avatar Sep 07 '23 20:09 qaasimahmad

can any one tell me how to acheive this redis connection using rediss ssl is required i am writing the code like this const redisClient = createClient({

host:"localhost",
port:6379,
  tls:{
    key: fs.readFileSync(path.join(__dirname,"../../certificates/key.pem")),    
  cert: fs.readFileSync(path.join(__dirname,"../../certificates/cert.pem")),

},

}); i have generated private key and cert using open ssl

sriramguptathallada avatar Sep 14 '23 06:09 sriramguptathallada