Reputation: 51
I have an app that is using express and sequelize. I built the app a month ago and everything was working fine. The client wanted to wait to finish it because they ran out of money. They contacted me so I opened up the app and when I ran it I got a clean exit. I have since isolated the issue to the sequelize connection and specifically the postgreSQL connection as it booted right up when i switched the connection to a mysql database. I know the user/pass/host/port/dbname are correct and the postgre server is running. Anybody have any ideas why this is happening?
This is the sequelize connection/server start code:
require('./config').sync()
.then(() => app.listen(process.env.PORT || 3000))
.catch(e => console.error(e))
This is my db config file:
const Sequelize = require('sequelize')
module.exports = new Sequelize(process.env.DATABASE_URL || process.env.LOCAL_URL)
This is my local_url .env variable:
postgres://root:password@localhost:5432/aoo_db
I know this code works as it was working before and it works with a mysql database.
Upvotes: 0
Views: 268
Reputation: 51
Ok so what I did was just reinstall the postgres npm packages. It's weird because I deleted and reinstalled my node_modules multiple times and it didn't work but once i deleted and reinstall pg individually it started working.
Upvotes: 3