so I have a basic Node.js/Express/Mysql app I'm working on that just takes addresses and logs tipping history on them, as a tool for delivery workers to use. ( https://shittip.com )
This is set up on a Digital Ocean droplet (ubuntu 16.04 - nginx - SSL enabled), and I cloned my github repo to bring the files in. https://github.com/Yintii/sh-tT-ps
The port and credentials for the live site and live site's DB are correct, the user and pass and the same as what I used for my set up locally, and the port being anything other than 3306 creates a 502 error with Nginx as I've defined that as the proxy in the config file for it already as well.
The error from the pm2 logs is showing that the connection gets closed, and it's pretty much the first thing that happens -> https://pastebin.com/3XbjkTx7
My connection code is pretty basic:
connectDB.js
var config = require('./exports');
var mysql = require('mysql');
var db = mysql.createConnection({
host: config.host,
user: config.user,
password: config.password,
database: config.database,
port: config.port
});
db.connect(function(err) {
if (err) throw err;
console.log("Connected!");
});
module.exports = {
db
};
The exports file is also pretty clean and basic
exports.js
module.exports = {
host: "localhost",
port: '3306',
user: "root",
password: ---------,
database: "addresses"
}
This is not an issue or anything I originally had to troubleshoot while developing the app locally, this is the first time I've had this problem.
This is how it's supposed to respond, and how it currently responds when I run the app on my LOCAL machine:
https://gyazo.com/075ba6013647ec1a4825b18b1846b05c
This is how the app is responding on my droplet:
https://gyazo.com/60af2ff0f65823ef653721c45ed766ef
The only files that are different are the ones that define the exports and the database connection. Any insight is greatly appreciated.
edit
Oh and I also changed the server variable in my main.js to reflect my domain name and not localhost, so that's not it, that causes a different larger error