Search code examples
node.jsexpressherokuredisexpress-session

Redis on Heroku connection error : 127.0.0.1 instead of REDIS_URL


What is the proper setting for using express-sessions and connect-redis when deployed on Heroku. Heroku says to use the REDIS_URL param, but it must not be working because I keep getting error that it is trying to connect to 127.0.0.1

const session = require('express-session')
const RedisStore = require('connect-redis')(session)

const store = new RedisStore({
  connectionString: process.env.REDIS_URL,
  logErrors: true
})

I have tried setting 'connectionString' as 'client' that gives me error, host, error. What is the proper setting I am missing here and can't find anywhere online.


Solution

  • change connectionString to url

    This comes directly from the documentation for the npm package connect-redis found here... https://www.npmjs.com/package/connect-redis