Nodejs Sequelize Postgress Not Connected error ETIMEDOUT
this is my setup
require('dotenv').config();
const parse = require('pg-connection-string').parse;
const connectionString = process.env.DATABASE_URL;
const connector = parse(connectionString);
const configdb = {
username: connector.user,
password: connector.password,
database: connector.database,
host: connector.host,
dialect: 'postgres',
port: connector.port,
pool: {
max: 20,
min: 0,
acquire: 30000,
idle: 1000,
},
migrationStorageTableName: 'sequelize_meta',
};
module.exports = configdb;
when i follow instruction still error using dialectoption this post Using Heroku Postgres From A Fly App · Fly
require('dotenv').config();
const parse = require('pg-connection-string').parse;
const connectionString = process.env.DATABASE_URL;
const connector = parse(connectionString);
const dialectConfig = {
ssl: { sslmode: 'require', rejectUnauthorized: false },
keepAlive: true,
idle_in_transaction_session_timeout: 1000,
};
const configdb = {
username: connector.user,
password: connector.password,
database: connector.database,
host: connector.host,
dialect: 'postgres',
port: connector.port,
dialectOptions: process.env.NODE_ENV == 'production' ? dialectConfig : null,
pool: {
max: 20,
min: 0,
acquire: 30000,
idle: 1000,
},
migrationStorageTableName: 'sequelize_meta',
};
module.exports = configdb;
response : ETIMEDOUT
When i’m connect on local this can connect to database postgresql on fly.io Postgres.
maybe i forgot on my setup?