With Gitpod, Heroku Postgres returning Error: FATAL: role ... does not exist

560 views Asked by At

I have a Heroku app and it has a Heroku postgres addon attached. Im trying to connect to the remote heroku database from the Gitpod (online IDE) command line.

heroku pg:psql -a my-heroku-app

But its giving the following error:

--> Connecting to postgresql-rigid-XXXXX
psql: error: could not connect to server: FATAL:  role "xxxxxxxxxxxxxxx" does not exist

And I get the same error when I try to connect with the connection URL

psql postgres://xxxxxxxxxxxxxxx:[email protected]:5432/ddddddddddddd

I have properly installed postgres and heroku-cli in Gitpod and they work fine.
Appreciate your help.
Thanks!

1

There are 1 answers

0
dahamv On BEST ANSWER

Ok I found the answer thanks to this and this.

heroku pg:psql does'nt seem to work in Gitpod. So I followed this to import a db dump file into heroku postgres. From Gitpot command line I did

pg_dump -Fc --no-acl --no-owner -h localhost -U myuser mydb > mydb.dump

and got the db dump file from my local (Gitpod) database. Uploaded it to my google drive and got the publicly downloadable link. Then did

heroku pg:backups:restore https://drive.google.com/u/0/uc?xxxxxxxx DATABASE_URL -a my-heroku-app

Now I have all the data in my heroku postgres database.
Cheers!