title: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379 Heroku
body: <p>I have created a Nodejs server that uses Redis. It runs fine when I am running it in my machine. But I get the error above when I try to push the code to heroku. I already installed Redis togo and I can see the <code>REDISTOGO_URL</code> in my config variable. </p>
  
  <p>Following some Stackoverflow posts I did:</p>
  
  <pre><code>let RedisStore = require('connect-redis')(session)
  
  let redisClient = redis.createClient()
  if(process.env.REDISCLOUD_URL){
      let redisURL = url.parse(process.env.REDISCLOUD_URL);
      redisClient = redis.createClient(redisURL)
  }
  </code></pre>
  
  <p>My app runs fine in development but when I try to start my app in heroku I get the following error when I do <code>heroku logs --tail</code> :</p>
  
  <blockquote>
    <p>Error: Redis connection to 127.0.0.1:6379 failed - connect
    ECONNREFUSED 127.0.0.1:6379</p>
  </blockquote>