Installing on Heroku
-
I just exactly followed the instructions here: https://docs.nodebb.org/en/latest/installing/cloud/heroku.html
I don't know what I should change.
-
@setpixel it's related to your database settings. Your password or some other setting is incorrect.
-
I can confirm this, I had the same issue, it started happening recently, specifically when connecting to Heroku's Redis addons. It is most likely caused by some extra security changes done on those outwardly exposed redis stores.
I found a workaround for it for now, was thinking about putting a pull request in, it involves simply supporting a "url" field for the redis database configs in config.json
If a dev sees this, please let me know if you would like me to do it or if you are working on your own solution.
Meanwhile, the fix:
in nodebb/src/database/redis.js (https://github.com/NodeBB/NodeBB/blob/master/src/database/redis.js) replace the following:
if (redis_socket_or_host && redis_socket_or_host.indexOf('/') >= 0) { cxn = redis.createClient(nconf.get('redis:host'), options); } else { cxn = redis.createClient(nconf.get('redis:port'), nconf.get('redis:host'), options); }
with
cxn = redis.createClient(process.env.REDIS_URL, options);
where process.env.REDIS_URL should have your full redis connection url ("redis://...") as set by heroku
also since the redis url string includes the password, you may want to remove the following bit in the same code block
if (nconf.get('redis:password')) { cxn.auth(nconf.get('redis:password')); }
Finally, a more general solution would be nice, again if anyone could mention a dev here please let me know if the config change solution is desirable.
Cheers!
-
Can I just say, really shitty experience today.
I posted an issue in Github, which was immediately closed and he told me to post in here.
Then a moderator is saying that my password is incorrect?
It's a bug.
Just like @zoharm, I was able to fix the issue.
** The issue has nothing to do with Heroku ** I was able to recreate the issue locally. This issue is entirely related to a redis server having a password.
My fix was to add the lines in in nodebb/src/database/redis.js (https://github.com/NodeBB/NodeBB/blob/master/src/database/redis.js) at line 77:
if (nconf.get('redis:password')) {
options.password = nconf.get('redis:password');
}My guess is that the redis package was updated and introduced the bug.
Should probably issue a fix ASAP as no one with redis and a password will work with a new install.
Also, maybe don't close out issues immediately for something that is straight up a new bug. Oh and uh, fix yo shit.
-
@setpixel My apologies for not prefacing my response with "I think." It was most simple explanation given the information I had at the time. This issue you were having, based on everything you said, indicated an issue with your settings, not an issue with NodeBB.
The reason your Github issue was closed (I'm assuming because I don't know what exactly you said) was most likely because at face value what you are describing, and what the error message you provided points to is a problem involving your database authentication settings.
When you said you tested this locally, I assumed you meant you tested it with the same exact settings, which would of course mean you would get the same error from Heroku. I didn't realize you just tried setting a password on your local Redis database.
You have to understand that the vast majority of issues presented on this site are basic technical issue encountered by people who are not acquainted with debugging or working within the systems NodeBB runs on.
So, if you don't mind, please open a new Github issue with what you've found including the NodeBB commit hash and the redis npm package version. Thanks!
-
I can confirm that the bug is valid - in my experienced opinion - and on the side of NodeBB (or probably a mistake on side of its dependencies).
Reproduced locally with a fresh setup.
@zoharm You can achieve the same circumvention by just using the
redis:host
property within the config.json (or the setup procedure) for the redis url like"host": "redis://:[email protected]:6379"
This does not require any code modifications
To keep the reference to the already filed issue: gh#5069
-
@frissdiegurke @setpixel thanks for the info guys!
Now I am curious though, I was always using v1.1.2 and it worked fine for a while on Heroku (which uses passworded redis servers). How did the issue suddenly start happening just recently? Dependencies couldn't have changed without a version change, right?
-
@zoharm Dependencies are allowed to change within a certain version range. If a package follows the semver specification (and does not introduce breaking bugs) there should never be problems with this for the version ranges NodeBB uses.
But in this case it seems thesocket.io-redis
(or maybe even one of its dependencies) has introduced such a bug approximately 5 days ago.