mardi 31 mars 2015

Error creating two Redis To Go clients in NodeJS on Heroku

I've got a single web dyno running on a Heroku app that's built using NodeJS and it's using a single Redis To Go database on the Nano (free) tier. That tier is supposed to support up to ten connections, yet if I try to connect to it in two different modules using:



var redis_url = require('url').parse(process.env.REDISTOGO_URL);
var redis = require('redis').createClient(redis_url.port, redis_url.hostname);


I get this error when trying to start the app:



Error: Ready check failed: NOAUTH Authentication required. Mar 31 21:52:18 <> app/web.1: at RedisClient.on_info_cmd (/app/node_modules/redis/index.js:380:35)



The REDISTOGO_URL environment variable is set correctly, and if I remove the code from one of the modules then it starts fine with no errors. I could create one client and pass it to each module, but I'd really prefer to understand what's actually causing the problem here.


Can somebody explain what's going on?


Aucun commentaire:

Enregistrer un commentaire