Heroku Redis SSL wrong version number error in worker/Threading/Redis pubsub

239 Views Asked by At

I have implemented Redis pubsub feature using threading in python It was working when i used heroku redis mini plan but after upgrading it to premium 0 it is throwing wrong version number error 2023-05-01T09:16:06.628140+00:00 app[worker1.1]: : [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:2546)

I am using Redis 6.2.11 and python 3.11 According to the docs i have setup my redis like this

import os
from urllib.parse import urlparse
import redis



def connect():
    redis_url = os.environ.get('REDIS_URL')
    if os.environ.get('FLASK_ENV') == 'development':
        redis_url = 'rediss://localhost:6379'
        pool = redis.ConnectionPool(host='localhost', port=6379, db=0)
        return redis.Redis(connection_pool=pool,ssl_cert_reqs=None)
    url =  urlparse(redis_url)
    return redis.Redis(host=url.hostname, port=int(url.port), password=url.password,ssl=True, ssl_cert_reqs=None)

redis_instance = connect()
# Set up Redis Pub/Sub to listen for messages
pubsub = redis_instance.pubsub()
pubsub.subscribe('intents_update_channel')

Outside of threading this redis is working but in threading it is not

I have contacted heroku support but they are simply asking to ignore the error which is not useful

0

There are 0 best solutions below