When running locally and connecting to Heroku with the same DATABASE_URL, I'm able to connect and query the db perfectly fine.
When the same code is running on Heroku -- the query never returns and will eventually time out.
DB Code:
const connectionString = process.env.DATABASE_URL;
const pool = new Pool(
{
connectionString: connectionString,
ssl: true
}
);
public async query(text: any, params: any): Promise<any> {
return pool.query(text, params);
}
This works as expected when I run on localhost and attach to the Heroku Postgres add-on (Hobby tier), but when deployed to Heroku it no longer works. The DATABASE_URL is loaded correctly though.