Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • ep_mypads ep_mypads
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 57
    • Issues 57
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 7
    • Merge requests 7
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • FramasoftFramasoft
  • EtherpadEtherpad
  • ep_mypadsep_mypads
  • Issues
  • #248
Closed
Open
Issue created Mar 31, 2021 by Clemens H@datacop

postgres TypeError: Cannot read property 'query' of undefined

Description of the bug

ep_mypads crashes etherpad with postgres database on startup with the following stacktrace:

 [2021-03-31 17:40:07.007] [ERROR] server - TypeError: Cannot read property 'query' of undefined
     at Object.module.exports.storage.fn.getKeysUncached (/opt/etherpad-lite/node_modules/ep_mypads/storage.js:123:41)
     at /opt/etherpad-lite/node_modules/ep_mypads/model/user-cache.js:74:18
     at /opt/etherpad-lite/src/node_modules/ueberdb2/index.js:101:75
     at cb (util.js:207:31)
     at processTicksAndRejections (internal/process/task_queues.js:80:21)

Do you have a hint about the bug resolution?

    if (storage.db && (storage.db.type === 'postgres' || storage.db.type === 'postgrespool')) {
      var query = 'SELECT key, value FROM store WHERE key = ANY ($1)';
      return storage.db.db.wrappedDB.db.query(query, [keys], function (err, queryResult) {

The root cause seems to be that storage.db.db.wrappedDB.db as used in storage.js:123 is not exported in ueberdb anymore, I am not sure if direct queries to the database are still possible.

What is your version of Etherpad?

Your Etherpad version is 1.8.13 (5db0c8d)

(docker image etherpad:stable)

What is your version of MyPads?

Installed plugins: ep_mypads@1.7.19

What is your authentication method?

CAS via Keycloak, but the crash also happens if ep_mypads is not configured in settings.

Please, provide some logs if relevant

full log output:

etherpad_1  | [2021-03-31 17:39:55.838] [INFO] console - No credentials file found in /opt/etherpad-lite/credentials.json. Ignoring.
etherpad_1  | [2021-03-31 17:39:55.842] [INFO] console - Using skin "colibris" in dir: /opt/etherpad-lite/src/static/skins/colibris
etherpad_1  | [2021-03-31 17:39:55.843] [INFO] console - Session key file "/opt/etherpad-lite/SESSIONKEY.txt" not found. Creating with random contents.
etherpad_1  | [2021-03-31 17:39:55.845] [INFO] console - Random string used for versioning assets: 135492f7
etherpad_1  | [2021-03-31 17:39:56.419] [INFO] server - Starting Etherpad...
etherpad_1  | [2021-03-31 17:39:56.540] [INFO] plugins - Running npm to get a list of installed plugins...
etherpad_1  | [2021-03-31 17:39:56.956] [INFO] plugins - npm --version: 6.14.11
etherpad_1  | [2021-03-31 17:40:02.911] [INFO] plugins - Loading plugin ep_etherpad-lite...
etherpad_1  | [2021-03-31 17:40:02.912] [INFO] plugins - Loading plugin ep_mypads...
etherpad_1  | [2021-03-31 17:40:02.917] [INFO] plugins - Loaded 2 plugins
etherpad_1  | [2021-03-31 17:40:03.660] [INFO] APIHandler - Api key file "/opt/etherpad-lite/APIKEY.txt" not found.  Creating with random contents.
etherpad_1  | [2021-03-31 17:40:04.572] [INFO] server - Installed plugins: ep_mypads@1.7.19
etherpad_1  | [2021-03-31 17:40:04.592] [INFO] console - Report bugs at https://github.com/ether/etherpad-lite/issues
etherpad_1  | [2021-03-31 17:40:04.594] [INFO] console - Your Etherpad version is 1.8.13 (5db0c8d)
etherpad_1  | [2021-03-31 17:40:06.409] [INFO] http - HTTP server listening for connections
etherpad_1  | [2021-03-31 17:40:06.410] [INFO] console - You can access your Etherpad instance at http://0.0.0.0:9001/
etherpad_1  | [2021-03-31 17:40:06.410] [INFO] console - The plugin admin page is at http://0.0.0.0:9001/admin/plugins
etherpad_1  | [2021-03-31 17:40:06.410] [INFO] server - Etherpad is running
etherpad_1  | [2021-03-31 17:40:07.007] [ERROR] server - Metrics at time of fatal error:
etherpad_1  | {
etherpad_1  |   "httpStartTime": 1617212406409,
etherpad_1  |   "memoryUsage": 149884928,
etherpad_1  |   "memoryUsageHeap": 33353448,
etherpad_1  |   "ueberdb_lockAwaits": 0,
etherpad_1  |   "ueberdb_lockAcquires": 126,
etherpad_1  |   "ueberdb_lockReleases": 126,
etherpad_1  |   "ueberdb_reads": 112,
etherpad_1  |   "ueberdb_readsFailed": 0,
etherpad_1  |   "ueberdb_readsFinished": 112,
etherpad_1  |   "ueberdb_readsFromCache": 86,
etherpad_1  |   "ueberdb_readsFromDb": 26,
etherpad_1  |   "ueberdb_readsFromDbFailed": 0,
etherpad_1  |   "ueberdb_readsFromDbFinished": 26,
etherpad_1  |   "ueberdb_writes": 14,
etherpad_1  |   "ueberdb_writesFailed": 0,
etherpad_1  |   "ueberdb_writesFinished": 14,
etherpad_1  |   "ueberdb_writesObsoleted": 0,
etherpad_1  |   "ueberdb_writesToDb": 14,
etherpad_1  |   "ueberdb_writesToDbFailed": 0,
etherpad_1  |   "ueberdb_writesToDbFinished": 14,
etherpad_1  |   "totalUsers": 0
etherpad_1  | }
etherpad_1  | [2021-03-31 17:40:07.007] [ERROR] server - TypeError: Cannot read property 'query' of undefined
etherpad_1  |     at Object.module.exports.storage.fn.getKeysUncached (/opt/etherpad-lite/node_modules/ep_mypads/storage.js:123:41)
etherpad_1  |     at /opt/etherpad-lite/node_modules/ep_mypads/model/user-cache.js:74:18
etherpad_1  |     at /opt/etherpad-lite/src/node_modules/ueberdb2/index.js:101:75
etherpad_1  |     at cb (util.js:207:31)
etherpad_1  |     at processTicksAndRejections (internal/process/task_queues.js:80:21)
etherpad_1  | [2021-03-31 17:40:07.007] [INFO] server - Exiting...
etherpad_1  | [2021-03-31 17:40:07.007] [INFO] server - Stopping Etherpad...
etherpad_1  | [2021-03-31 17:40:07.008] [INFO] http - Closing HTTP server...
etherpad_1  | [2021-03-31 17:40:07.009] [INFO] socket.io - Closing socket.io engine...
etherpad_1  | [2021-03-31 17:40:07.010] [INFO] socket.io - All socket.io clients have disconnected
etherpad_1  | [2021-03-31 17:40:07.019] [INFO] http - HTTP server closed
etherpad_1  | [2021-03-31 17:40:07.023] [INFO] console - Database closed
etherpad_1  | [2021-03-31 17:40:07.045] [INFO] server - Etherpad stopped
etherpad_1  | [2021-03-31 17:40:07.046] [INFO] server - Waiting for Node.js to exit...
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking