Mayil-AI / bugbug-21dec23

Mozilla Public License 2.0
0 stars 0 forks source link

Bugbug HTTP service failing to connect to Redis (hashtag4028) #5

Open vikramsubramanian opened 6 months ago

vikramsubramanian commented 6 months ago

Heroku switched our Redis instance to SSL, and they are using self-signed certificates so we fail to validate them.

redis.exceptions.ConnectionError: Error 1 connecting to [ec2-44-194-67-42.compute-1.amazonaws.com:32269]( [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997). )

mayil-ai[bot] commented 6 months ago

Possible Solution

def initialize_redis_connection(host, port, ssl_cert_required):
    connection = redis.Redis(
        host=host,
        port=port,
        ssl=True,
        ssl_cert_reqs='none'  # Disable SSL certificate verification
    )
    return connection
# In http_service/bugbug_http/app.py and http_service/bugbug_http/worker.py
redis_conn = initialize_redis_connection('ec2-44-194-67-42.compute-1.amazonaws.com', 32269, False)

Code snippets to check

http_service → bugbug_http → app.py This snippet contains the Redis connection setup for the HTTP service, which is likely where the SSL configuration needs to be adjusted to handle the new self-signed certificates. https://github.com/Mayil-AI/bugbug-21dec23/blob/0acd00da46afbb37bd047c0bce06ce7cfad21568/http_service/bugbug_http/app.py#L1-L96
http_service → bugbug_http → worker.py This snippet includes Redis connection setup for the worker process, which may also require changes to accommodate the new SSL requirements for Redis connections. https://github.com/Mayil-AI/bugbug-21dec23/blob/0acd00da46afbb37bd047c0bce06ce7cfad21568/http_service/bugbug_http/worker.py#L1-L37
http_service → bugbug_http → models.py This snippet shows the Redis connection being used in the models module, which might be relevant if the SSL configuration needs to be consistent across different parts of the application. https://github.com/Mayil-AI/bugbug-21dec23/blob/0acd00da46afbb37bd047c0bce06ce7cfad21568/http_service/bugbug_http/models.py#L1-L55