0
  • windows 10
  • postgres version - 13.0
  • aqueduct version - 3.3.0+1
  • created the database and user correctly
  • created the migration

I can connect to database using psql.

postgresql.conf contains listen_addresses = '*', port = 5432

When I enter the command :

aqueduct db upgrade --connect postgres://app_user:password@localhost:5432/app

I get error :

There was an error connecting to the database 'app_user:password@localhost:5432/app'. Reason: unable to connect to database.

I have searched hundreds of sources already. This is a new problem that I am not the only one facing. Nobody has solved it yet!

Hero, help me please!

Spasibo
  • 144
  • 7
  • Can you connect using `psql` e.g `psql -d app -U app_user -h localhost -p 5432`? What are the contents of your `pg_hba.conf` file? – Adrian Klaver Oct 04 '20 at 20:28
  • @AdrianKlaver Yes, I can. – Spasibo Oct 04 '20 at 20:32
  • @AdrianKlaver pg_hba.conf - listen_addresses = '*', port = 5432. – Spasibo Oct 04 '20 at 20:33
  • Add the previous information to your question. Also answers to following. It will save others from working through the comments. Is `aqueduct` on the same machine as the Postgres server?. Have you looked at the Postgres log to see what it says? – Adrian Klaver Oct 04 '20 at 20:38
  • @AdrianKlaver Sorry, I'm new to this platform. Yes, in one machine. log_destination ----------------- stderr (1 row) Are you talking about this? – Spasibo Oct 04 '20 at 20:49
  • Actually `listen_addresses = '*', port = 5432` are in `postgresql.conf`. The logging would be done to a file via `stderr`. Use `SHOW data_directory` in `psql` to find the directory it will most likely be in. – Adrian Klaver Oct 04 '20 at 20:58
  • @AdrianKlaver I found. Sorry but I dont understand what exactly should I do? – Spasibo Oct 04 '20 at 21:20
  • Can you please post the pg_hba.conf content? If connecting works with psql and not with aqueduct they might use different methods like ssl vs. nossl. – clamp Oct 04 '20 at 21:20
  • post relevant parts of the logfile ... – clamp Oct 04 '20 at 21:22
  • @clamp here is the file - https://yadi.sk/d/HWlzBdat2qkQvw – Spasibo Oct 04 '20 at 21:26
  • Try to add `hostssl all all 127.0.0.1/32 scram-sha-256` and check that ssl is enabled in *postgresql.conf*. Just a guess though... – clamp Oct 04 '20 at 21:29
  • @clamp I added it and changed #ssl = on (it was off). Still doesn't work :( – Spasibo Oct 04 '20 at 21:37
  • changing ssl requires restart... – clamp Oct 04 '20 at 21:43
  • @clamp I restarted whole laptop. Still... – Spasibo Oct 04 '20 at 21:49
  • Did you check the log? Can you add it to the Question? And btw. did you remove this comment # from `#ssl = on`? – clamp Oct 04 '20 at 21:53
  • @clamp 2020-10-05 00: 56: 00.437 MSK [9716] MESSAGE: entry with hostssl is invalid because SSL is disabled 2020-10-05 00: 56: 00.437 MSK [9716] TIP: Set ssl = on in postgresql.conf. 2020-10-05 00: 56: 00.437 MSK [9716] CONTEXT: line 94 of the configuration file "C: / Program Files / PostgreSQL / 13 / data / pg_hba.conf" – Spasibo Oct 04 '20 at 21:58
  • @clamp yes, I did. Same. – Spasibo Oct 04 '20 at 22:04
  • `#` is a comment sign remove that from `ssl = on` ( and restart the server). But then: What does your logfile say about the failed connection attempts? – clamp Oct 04 '20 at 22:07
  • Try `postgres://app_user:password@localhost:5432/app?sslmode=disable` – Adrian Klaver Oct 05 '20 at 00:00

1 Answers1

1

Hello brothers in misfortune!

I found a solution to this problem!

I rolled back the version of PostgreSQL to 10.14. It's stable.

My file pubspec.yaml I changed to this:

dependencies:
  aqueduct: ^4.0.0-b1

dev_dependencies:
  test: ^1.0.0
  aqueduct_test: ^2.0.0-b1

BUT IMPORTANT. Enter the command: pub global activate aqueduct 4.0.0-b1

I couldn't solve this problem for 3 days! I'm happy...

I hope I can help someone else.

Spasibo
  • 144
  • 7