Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error connecting Etherpad-lite to Redis database #4693

Closed
sbutler-gh opened this issue Jan 31, 2021 · 6 comments
Closed

Error connecting Etherpad-lite to Redis database #4693

sbutler-gh opened this issue Jan 31, 2021 · 6 comments

Comments

@sbutler-gh
Copy link

When attempting to configure a Redis database with the following format (from this documentation):

  "dbType": "${DB_TYPE:redis}",
  "dbSettings": {
    "host":     "${DB_HOST:url}",
    "port":     "${DB_PORT:port}",
    "database": "${DB_NAME:0}",
    "password": "${DB_PASS:password}"
  },
  

I repeatedly got this error:

/opt/etherpad-lite/src/node_modules/async/dist/async.js:318

if (fn === null) throw new Error("Callback was already called.");

^

Error: Callback was already called.

at /opt/etherpad-lite/src/node_modules/async/dist/async.js:318:36

at Object.callbackOrEmit [as callback_or_emit] (/opt/etherpad-lite/src/node_modules/redis/lib/utils.js:89:9)

at Command.callback (/opt/etherpad-lite/src/node_modules/redis/lib/individualCommands.js:199:15)

at normal_reply (/opt/etherpad-lite/src/node_modules/redis/index.js:654:21)

at RedisClient.return_reply (/opt/etherpad-lite/src/node_modules/redis/index.js:752:9)

at JavascriptRedisParser.returnReply (/opt/etherpad-lite/src/node_modules/redis/index.js:137:18)

at JavascriptRedisParser.execute (/opt/etherpad-lite/src/node_modules/redis-parser/lib/parser.js:544:14)

at Socket.<anonymous> (/opt/etherpad-lite/src/node_modules/redis/index.js:218:27)

at Socket.emit (events.js:198:13)

at Socket.EventEmitter.emit (domain.js:448:20)

I encountered this error after with both Docker and non-Docker installations (settings.json.template and settings.json.docker)

While troubleshooting, I came across the discussion of setting values of HOST / PORT in this thread, which set me on the right path.

In the end, I updated the DBsettings in the settings.json.docker file according to the format in line 29 of this file: https://github.com/NodeRedis/node-redis/blob/master/lib/createClient.js

So the DB section of my settings.json.docker now looks like this:

  "dbType": "${DB_TYPE:redis}",
  "dbSettings": {
    "port":     "${DB_PORT:redis://:PASSWORD@HOST:PORT}"
  }

^ And that format has ended up working for me, when I run Etherpad in a docker container.

I'm not quite sure what the issue was with the original formatting, although this might be helpful to include in the documentation for Redis configurations

@JohnMcLear
Copy link
Member

Looks like the docs just need an update for correct redis config? Can you do that please @sbutler-gh ?

@sbutler-gh
Copy link
Author

@JohnMcLear when I posted this issue, I added an update to this documentation page.

Is that what you had in mind? Anything else?

@JohnMcLear
Copy link
Member

JohnMcLear commented Feb 1, 2021

Reading the code, it looks like the fix is required here:

https://github.com/ether/ueberDB/blob/master/databases/redis_db.js#L43

Testing in ether/ueberDB#182

@JohnMcLear
Copy link
Member

Give that a test @sbutler-gh - you will need to clone the ueberdb directly into etherpad/node_modules and do an npm install etc. -- I wouldn't test it on your production site tho, defo test on a throwaway instance 📦

@sbutler-gh
Copy link
Author

@JohnMcLear I went through the links, looks like a fix got identified and committed? I could test locally with ueberdb if it's important (for you/the project), but I'd need more of a step-by-step instruction for how to do that. To be clear, I'm not really concerned with my own instance in this case because I got these working already, so just let me know what would be preferable

@JohnMcLear
Copy link
Member

I think we're good to close this w/ the @rhansen fixes and the change to settings handle things should be better for Redis users now :)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants