0

I was trying to run heroku local or heroku local web and everything was working fine. After importing the data from my heroku remote to my local environment, it started to throw me the following error: enter image description here

After searching for the solution in some places, I tried restarting the postgresql service with brew services restart postgresql and it started normally but I kept receiving the error. I also tried to delete the postmaster.pid as suggested on this SO post PG::ConnectionBad - could not connect to server: Connection refused but didn't find the file.

André C. Rocha
  • 301
  • 5
  • 17

1 Answers1

0

Well, finding the solution was easier than I thought.

On this same post (PG::ConnectionBad - could not connect to server: Connection refused) it suggested to check the logs before deleting the file and I did even that I haven't finding the file to be deleted.

When I checked the logs, I came across the following: enter image description here

So, I checked the heroku's Postgres version and it uses the 12 as default but brew uses the latest, which is the 13th.

To sum up, I did a dump from a Postgre v12 to Postgre v13 and this is incompatible, so I'm going to downgrade my local Postgres to work with my data as expected.

To do that, I did the following:

brew uninstall postgres - to remove v13

brew install postgresql@12 - to install a specific version

brew services start postgresql@12 - to start the new version

Cool fact, I didn't need to restore or modify the data because it wasn't deleted even uninstalling the Postgresql.

André C. Rocha
  • 301
  • 5
  • 17