Getting a 502 error

Previously I had an issue with node using ::1 instead of 127.0.0.1 to connect to my database. It was working but now getting a 502. The error log is reporting:

Jul 20 00:55:14 blog node[2292659]: {
Jul 20 00:55:14 blog node[2292659]:   message: {
Jul 20 00:55:14 blog node[2292659]:     statusCode: 500,
Jul 20 00:55:14 blog node[2292659]:     errorType: 'DatabaseError',
Jul 20 00:55:14 blog node[2292659]:     level: 'critical',
Jul 20 00:55:14 blog node[2292659]:     message: 'Ghost was able to start, but errored during boot with: connect ECONNREFUSED ::1:3306',
Jul 20 00:55:14 blog node[2292659]:     id: 500,
Jul 20 00:55:14 blog node[2292659]:     help: 'Unknown database error',
Jul 20 00:55:14 blog node[2292659]:     name: 'DatabaseError',
Jul 20 00:55:14 blog node[2292659]:     code: 'ECONNREFUSED',
Jul 20 00:55:14 blog node[2292659]:     property: null,
Jul 20 00:55:14 blog node[2292659]:     redirect: null,
Jul 20 00:55:14 blog node[2292659]:     hideStack: false,
Jul 20 00:55:14 blog node[2292659]:     errno: -111,
Jul 20 00:55:14 blog node[2292659]:     syscall: 'connect',
Jul 20 00:55:14 blog node[2292659]:     address: '::1',
Jul 20 00:55:14 blog node[2292659]:     port: 3306,
Jul 20 00:55:14 blog node[2292659]:     fatal: true
Jul 20 00:55:14 blog node[2292659]:   }
Jul 20 00:55:14 blog node[2292659]: }

DB config is still this:

  "database": {
    "client": "mysql",
    "connection": {
      "host": "127.0.0.1",
      "user": "strange",
      "password": "password!",
      "database": "strange_prod"
    }

Any suggestions?

I tried to fix it by telling mysql to allow connections from ::1, and now it reports:

Jul 20 02:41:29 blog node[2372825]: {
Jul 20 02:41:29 blog node[2372825]:   message: {
Jul 20 02:41:29 blog node[2372825]:     statusCode: 500,
Jul 20 02:41:29 blog node[2372825]:     errorType: 'DatabaseError',
Jul 20 02:41:29 blog node[2372825]:     level: 'critical',
Jul 20 02:41:29 blog node[2372825]:     message: "Ghost was able to start, but errored during boot with: Access denied for user 'root'@'localhost'",
Jul 20 02:41:29 blog node[2372825]:     id: 500,
Jul 20 02:41:29 blog node[2372825]:     help: 'Unknown database error',
Jul 20 02:41:29 blog node[2372825]:     name: 'DatabaseError',
Jul 20 02:41:29 blog node[2372825]:     code: 'ER_ACCESS_DENIED_NO_PASSWORD_ERROR',
Jul 20 02:41:29 blog node[2372825]:     property: null,
Jul 20 02:41:29 blog node[2372825]:     redirect: null,
Jul 20 02:41:29 blog node[2372825]:     hideStack: false,
Jul 20 02:41:29 blog node[2372825]:     errno: 1698,
Jul 20 02:41:29 blog node[2372825]:     sqlState: '28000',
Jul 20 02:41:29 blog node[2372825]:     sqlMessage: "Access denied for user 'root'@'localhost'"
Jul 20 02:41:29 blog node[2372825]:   }
Jul 20 02:41:29 blog node[2372825]: }

Not sure why its trying to connect via root now

I figured that part out, wrong config attempting to be ran.
Nginx error log reports:

2023/07/20 02:57:14 [error] 2189460#2189460: *771 connect() failed (111: Unknown error) while connecting to upstream, client: 162.121.245.100, server: enigmatic.zone, request: "GET / HTTP/2.0", upstream: "http://127.0.0.1:2368/", host: "enigmatic.zone"

1 Like

As I never got a response on even where to look for the issue, will be wiping the VPS and trying it again. This time will be using the Docker version