Nodejs Sequelize Postgress Not Connected error ETIMEDOUT

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?

Sorry, can you fix this? I think I have the same problem

Try removing this line.

i was solved with move to app v2 follow this Migrate an Existing Fly App to Apps V2 · Fly Docs and using new postgres app flex docker image . please see Fly Postgres · Fly Docs

and for connect to database from local using fly proxy :slight_smile:

fly proxy 15432:5432 -a <postgres-app-name>

see : Connect With flyctl · Fly Docs

When was deployed :slight_smile: using .flycast

DATABASE_URL=postgres://user:password@appname.flycast:5432/dbname?sslmode=disable

When Local

DATABASE_URL=postgres://user:password@localhost:15432/dbname?sslmode=disable