question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

npm start error (TypeError: Cannot read properties of undefined (reading 'driver'))

See original GitHub issue

I have a fresh installation of the update server installed on my linux system. I have installed postgres with the documentation. On Startup i get the following error:

error: A hook (`orm`) failed to load!
error: Failed to lift app: Exception: `getConnection` failed ("failed").  Could not acquire a connection to the database using the specified manager.
Additional data:

{
  error: Error: getaddrinfo EAI_AGAIN electron_release_server_user
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {
    errno: -3001,
    code: 'EAI_AGAIN',
    syscall: 'getaddrinfo',
    hostname: 'electron_release_server_user'
  },
  meta: undefined
}
    at validateDatastoreConnectivity (/var/www/xxxx/node_modules/waterline/lib/waterline/utils/system/validate-datastore-connectivity.js:28:25)
    at /var/www/xxxx/node_modules/waterline/lib/waterline.js:722:18
    at Immediate.done [as _onImmediate] (/var/www/xxxx/node_modules/sails-postgresql/lib/adapter.js:72:16)
    at process.processImmediate (node:internal/timers:471:21)
error: More details (raw): {
  error: Error: getaddrinfo EAI_AGAIN electron_release_server_user
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {
    errno: -3001,
    code: 'EAI_AGAIN',
    syscall: 'getaddrinfo',
    hostname: 'electron_release_server_user'
  },
  meta: undefined
}
/var/www/xxxx/node_modules/waterline/lib/waterline/utils/system/validate-datastore-connectivity.js:22
console.log(adapterDSEntry.driver.getConnection);
                           ^

TypeError: Cannot read properties of undefined (reading 'driver')
    at validateDatastoreConnectivity (/var/www/xxxx/node_modules/waterline/lib/waterline/utils/system/validate-datastore-connectivity.js:22:28)
    at /var/www/xxxx/node_modules/waterline/lib/waterline.js:722:18
    at /var/www/xxxx/node_modules/sails-disk/node_modules/async/dist/async.js:473:16
    at eachOfArrayLike (/var/www/xxxx/node_modules/sails-disk/node_modules/async/dist/async.js:1060:9)
    at eachOf (/var/www/xxxx/node_modules/sails-disk/node_modules/async/dist/async.js:1120:5)
    at Object.eachLimit (/var/www/xxxx/node_modules/sails-disk/node_modules/async/dist/async.js:3175:5)
    at /var/www/xxxx/node_modules/sails-disk/index.js:120:15
    at /var/www/xxxx/node_modules/sails-disk/index.js:112:18
    at proceedToFinalAfterExecLC (/var/www/xxxx/node_modules/parley/lib/private/Deferred.js:1157:14)
    at proceedToInterceptsAndChecks (/var/www/xxxx/node_modules/parley/lib/private/Deferred.js:913:12)
    at proceedToAfterExecSpinlocks (/var/www/xxxx/node_modules/parley/lib/private/Deferred.js:845:10)
    at /var/www/xxxx/node_modules/parley/lib/private/Deferred.js:303:7
    at /var/www/xxxx/node_modules/sails-disk/node_modules/machine/lib/private/help-build-machine.js:953:53
    at handlerCbs.success (/var/www/xxxx/node_modules/sails-disk/node_modules/machine/lib/private/help-build-machine.js:814:26)
    at /var/www/xxxx/node_modules/sails-disk/node_modules/machinepack-fs/machines/ensure-dir.js:50:20
    at /var/www/xxxx/node_modules/sails-disk/node_modules/fs-extra/lib/mkdirs/mkdirs.js:54:16
    at callback (/var/www/xxxx/node_modules/graceful-fs/polyfills.js:306:20)
    at FSReqCallback.oncomplete (node:fs:208:5)

so i have copied the local.js and filled in all fields. The interesting is that he tries to connect to “hostname: ‘electron_release_server_user’” but this is the username and not the host. The local.js is loaded and all hosts are set to “localhost”. We have checked this some times now. So he can’t resolve that name.

  datastores: {
    postgresql: {
      adapter: 'sails-postgresql',
      database: 'electron_release_server',
      host: 'localhost',
      user: 'electron_release_server_user',
      password: 'xxxxx',
      port: 5432
    }
  },

  session: {
    // Recommended: 63 random alpha-numeric characters for secret
    // Generate using: https://www.grc.com/passwords.htm
    secret: 'xxxxxx',
    database: 'electron_release_server_sessions',
    host: 'localhost',
    user: 'electron_release_server_user',
    password: 'xxxxx',
    port: 5432
  },

In the file were the error occurs i have printed the variable and driver is set. To tests if it’s working when node can resolve the IP i have added the username to the /etc/hosts. Then he can find the driver but not the connection.

/var/www/xxxx/node_modules/waterline/lib/waterline/utils/system/validate-datastore-connectivity.js:22
console.log(adapterDSEntry.driver.getConnection);
                                  ^
TypeError: Cannot read properties of undefined (reading 'getConnection')

Any ideas on that?

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rehoehlecommented, Dec 23, 2022

We have some pies running as webserver for some really small updates and sites. And i thought i install it on that system, too. Next time when i am at the office i will test the system on a normal Ubuntu. Thanks for your great help 😃

1reaction
rehoehlecommented, Dec 22, 2022

I have tested it with the Tag but same problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read properties of undefined (reading 'call ...
TypeError : Cannot read properties of undefined (reading 'call') on build but not dev ; setup: download the repro; navigate to "app"; npm...
Read more >
Cannot read property 'version' of undefined #2866 - GitHub
Version 3.1.0 Node and OS info Node v10.13.0 / npm 6.4.1 Steps to reproduce npm ... TypeError: Cannot read property 'version' of undefined...
Read more >
Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError: Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >
TypeError: Cannot read property 'startsWith' of undefined
Hi, im trying to connect to MongoAtlas run an app that uses mongodb (^4.3.1 ) in nodejs (version 10.19.0), Windows 7 & then...
Read more >
cannot read properties of undefined (reading 'configurations')
I am getting above error on browser console log: Uncaught TypeError: Cannot read properties of undefined (reading 'indexOf').
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found