aneagoie / smart-brain-api

Final project for ZTM course

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

process.env.DATABASE_URL = UNDEFINED

amineElabbadi opened this issue · comments

HI, Iiam using Heroku and for some reason, when I use process.env.DATABASE_URL to connect I get a connection error. When I set all the credentials manually (URL, username, password, db, port) the connection works. also when i do git push heroku master
can't register.

const db = knex ({
client: 'pg',
password : 'test',
connection: {
host: process.env.DATABASE_URL,
ssl: true,
}
});
reply
app is running on port undefined

Thanks for mentioning this. I am having the same problem. Dont know what to do

Thanks for raising this. I am facing the same issue.

connection: {
connectionString:"postgres://jqesonsaescvxi:05f1fb9cb204c4faf2cca445......." ,
ssl: { rejectUnauthorized: false },
}
try changing the host to a connectionString as process.env.DATABASE_URL is basically a envoirnment variable configured by heroku and return the url of the database.

Yes, it worked for me ! Thank. Change connectionString to your DATABASE_URL..

if process.env.DATABASE_URL is replaced by static string, then it might be unsecure.
isn't there any other way to fix that issue to resolve process.env.DATABASE_URL is undefined ?