Connection error with Heroku Redis and Python

639 Views Asked by At

I'm trying to connect to my Heroku Redis instance (free/hobby dev version) using the URL. It seems to connect fine, but once I try any commands, it fails and gives:

ConnectionError: Error while reading from MY_URL : 'An existing connection was forcibly closed by the remote host'

The code that runs without errors is:

import redis
my_redis = redis.from_url(MY_URL)

As soon as I try:

my_redis.set('foo', 'bar')

I get the error every time. I'm not sure what I'm doing wrong as I am following the exact python guide here. Below are my config settings. enter image description here

1

There are 1 best solutions below

0
On

In the config is says that it requires TLS, therefore, the setup should be as follows: enter image description here After using this setup, everything started to work fine.