New Node Server serving pages - DB not connecting

This morning I felt like I was walking on water - set up my first node.js server.

Pages were showing… but cannot use the login page. Getting this error:

{
“status”: “500”,
“code”: “ENOTFOUND”,
“message”: “getaddrinfo ENOTFOUND db”,
“stack”: “Error: getaddrinfo ENOTFOUND db\n at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:72:26)\n --------------------\n at Protocol._enqueue (/home/ppswealthuser/ppswealthmentor.co.za/public/node_modules/mysql/lib/protocol/Protocol.js:144:48)\n at Protocol.handshake (/home/ppswealthuser/ppswealthmentor.co.za/public/node_modules/mysql/lib/protocol/Protocol.js:51:23)\n at Connection.connect (/home/ppswealthuser/ppswealthmentor.co.za/public/node_modules/mysql/lib/Connection.js:116:18)\n at /home/ppswealthuser/ppswealthmentor.co.za/public/node_modules/knex/lib/dialects/mysql/index.js:66:18\n at new Promise ()\n at Client_MySQL.acquireRawConnection (/home/ppswealthuser/ppswealthmentor.co.za/public/node_modules/knex/lib/dialects/mysql/index.js:61:12)\n at create (/home/ppswealthuser/ppswealthmentor.co.za/public/node_modules/knex/lib/client.js:247:39)”
}

Hope one of the guru’s can help…

I found this thread with same type of error on Digital Ocean

Looks like there’s an issue with the db connection.

  1. Where is this Database? Docker?

  2. Can you screenshot your db connection settings in server connect?

  3. Can you screenshot the db connection settings in your project settings?

Thanks, I have tested my direct connection and it works:

That’s great! but you managed to not answer any of my questions :stuck_out_tongue_winking_eye:

You still have the error when loading the page right?

Can you answer the 3 questions above?

Sorry - was in a hurry.

  1. Dreamhost VPS
  2. I just changed it to same as my mysql direct connection. Waiting for upload
  3. Sent

Try to make the settings equal, since it works in your project settings. Make sure it’s the same in your server connect db settings.

Also, you’re using an external db? Or where is the db hosted

Changed it and when saving the file node runs installs on packages but gives this error:

Error: ENOENT: no such file or directory, unlink ‘/Users/marcelschmidt/Documents/myadvisor/restart_node.txt’ at Object.unlinkSync (fs.js:1210:3) at file:///Applications/Wappler.app/Contents/Resources/app/Shared/DMXzone/dmxAppCreator/UI/w2editor_ftp_manager.js:8:110050 at PipeSocket. (/Applications/Wappler.app/Contents/Resources/app/Shared/DMXzone/dmxAppCreator/UI/lib/lftp.js:8:5927) at PipeSocket.emit (events.js:327:22) at UnixTerminal.emit (/Applications/Wappler.app/Contents/Resources/app/node_modules/node-pty/lib/terminal.js:148:34) at PipeSocket. (/Applications/Wappler.app/Contents/Resources/app/node_modules/node-pty/lib/unixTerminal.js:87:27) at Object.onceWrapper (events.js:422:26) at PipeSocket.emit (events.js:327:22) at Pipe. (net.js:673:12)
Error: ENOENT: no such file or directory, unlink ‘/Users/marcelschmidt/Documents/myadvisor/restart_node.txt’ at Object.unlinkSync (fs.js:1210:3) at file:///Applications/Wappler.app/Contents/Resources/app/Shared/DMXzone/dmxAppCreator/UI/w2editor_ftp_manager.js:8:105548 at PipeSocket. (/Applications/Wappler.app/Contents/Resources/app/Shared/DMXzone/dmxAppCreator/UI/lib/lftp.js:8:5927) at PipeSocket.emit (events.js:327:22) at UnixTerminal.emit (/Applications/Wappler.app/Contents/Resources/app/node_modules/node-pty/lib/terminal.js:148:34) at PipeSocket. (/Applications/Wappler.app/Contents/Resources/app/node_modules/node-pty/lib/unixTerminal.js:87:27) at Object.onceWrapper (events.js:422:26) at PipeSocket.emit (events.js:327:22) at Pipe. (net.js:673:12)

The db and files are hosted on same VPS

Hmm that’s a new one for me…

What’s your ‘Server Type’ under targets in the project settings?

Ok, got it running. Was a db connect setting. Not sure which one since I just kept entering combinations of host name, etc till it worked.

What is strange is that I must go in via ssh and start the server manually using “node index.js” in the public folder. @Teodor is this normal?

1 Like