1

I have successfully installed postgresql, age and age-viewer on my m1 mac. But today it shows connection error

"Database Connection Failed
Failed to connect to the database. Are you sure the database is running on the server?
[]:(ECONNREFUSED) connect ECONNREFUSED 127.0.0.1:5430" 
log file details-
Error: Not connected
    at _callee3$ (/Users/sakibadnan/Desktop/Install/age-viewer/backend/src/controllers/databaseController.js:54:19)
    at tryCatch (/Users/sakibadnan/Desktop/Install/age-viewer/backend/node_modules/@babel/runtime/helpers/regeneratorRuntime.js:44:17)
    at Generator.<anonymous> (/Users/sakibadnan/Desktop/Install/age-viewer/backend/node_modules/@babel/runtime/helpers/regeneratorRuntime.js:125:22)
    at Generator.next (/Users/sakibadnan/Desktop/Install/age-viewer/backend/node_modules/@babel/runtime/helpers/regeneratorRuntime.js:69:21)
    at asyncGeneratorStep (/Users/sakibadnan/Desktop/Install/age-viewer/backend/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
    at _next (/Users/sakibadnan/Desktop/Install/age-viewer/backend/node_modules/@babel/runtime/helpers/asyncToGenerator.js:22:9)
    at /Users/sakibadnan/Desktop/Install/age-viewer/backend/node_modules/@babel/runtime/helpers/asyncToGenerator.js:27:7
    at new Promise (<anonymous>)
    at apply (/Users/sakibadnan/Desktop/Install/age-viewer/backend/node_modules/@babel/runtime/helpers/asyncToGenerator.js:19:12)
    at getStatus (/Users/sakibadnan/Desktop/Install/age-viewer/backend/src/controllers/databaseController.js:56:6)
info: ::ffff:127.0.0.1 - - [29/Mar/2023:05:47:09 +0000] "GET /api/v1/db HTTP/1.1" 500 51
 {"timestamp":"2023-03-29 11:47:09"}
info: ::ffff:127.0.0.1 - - [29/Mar/2023:05:47:09 +0000] "GET /api/v1/miscellaneous HTTP/1.1" 304 -
 {"timestamp":"2023-03-29 11:47:09"}
Error: connect ECONNREFUSED 127.0.0.1:5430
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
  errno: -61,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 5430
}
info: ::ffff:127.0.0.1 - - [29/Mar/2023:05:47:30 +0000] "POST /api/v1/db/connect HTTP/1.1" 500 85
 {"timestamp":"2023-03-29 11:47:30"}

I have tried to connect database in age-viewer but after successful installation it now refuse to connect although i have changed my port number?

RU-D
  • 224
  • 8
Maruf31
  • 17
  • 8

8 Answers8

0

I may add some clarifications (deduced from the question)
That error is shown on the running terminal which holds the age-viewer project and you have tried through the front-end to connect to your database and it gets that error on the terminal and for sure similar at the front-end page

There are some tips may help out

  1. Every-time you open your machine you will need to start the server to be able to connect to it
  2. Try to connect through pgsql to make sure the server is running
  3. Stop the process of the server and start it over again
  4. Try you connect again

Some commands you may need:

  1. server starting
/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
  1. database creation
/usr/local/pgsql/bin/createdb test
  1. test connection
/usr/local/pgsql/bin/psql test
0

Possible duplicate and this too.

To me it seems like loopback error.

Try:

127.0.0.1 to your address (Use netstat). Port to new port.

Example:

DATABASE_URL: postgres://username:pgpassword@127.0.0.1:5432/mydatabase
to

DATABASE_URL: postgres://username:pgpassword@0.0.0.0:19000/mydatabase

You can use netstat to help you:

netstat -na
RU-D
  • 224
  • 8
0

Restart the server create some test database then run connection test This maybe a cause of loopback adapter. Do this

127.0.0.1 to db_name

0

As I see you are using port 5430, First verify that the PostgreSQL server is listening on the correct port using this netstat -an | grep 5430 If there is no output, the PostgreSQL server is not listening on port 5430.

So now you have to check the PostgreSQL server's configuration in postgresql.conf file. The default port used by PostgreSQL is 5432. If you want to set it to a different value say 5430, update it accordingly. Save the configuration file and restart the PostgreSQL server.

0

Now you can have two things that maybe causing this and I think its most probablly the port you are using make sure that the server is listening on the correct port. You can update the post in postgresql.conf file. Before that check if the postgres server is listening on that port.

netstat -an

Now if is doesnt work change ports in reconfing file and try again Then the other problem might be that you might not have the correct npm version installed.Try checkimg your npm version i reccomend 14.16.0 for that try

nvm install 14.16.0

and then reinstall the Age viewer like you did before make sure your server is running

bin/pg_ctl -D example -l logfile start 
bin/createdb exampledb

And then load AGE

CREATE extension age; 

Load 'age';  

SET search_path = ag_catalog, "$user", public; 

you can ask me if you have anymore questions

0

This error tells that PostgreSQL is unable to connect with the age-viewer. Some of the possible solutions could be: Check and verify the PostgreSQL server logs and see if there are any errors or warnings about the connection requests. Verify age-viewer configurations and check if the database connectivity is configured correctly. Some software is still not compatible with the m1 mac architecture. Check and make sure that the application you're trying to run is supported with apple silicon. Check and see if any firewall or security software is blocking the connection. You need to make sure that the relevant ports are not being blocked

0

This error is arising because the AGE viewer application is unable to connect with the database server running on your local machine. So, try the following troubleshooting techniques:

  • Verify that Postgresql and AGE servers are running.
  • Verify the database configuration i.e host, port, username, password. These things should be correct.
  • Consider the restarting and reinstalling of the servers if the issue persists.
adil shahid
  • 125
  • 4
0

I have also faced this error. After installation, it was working perfectly fine but after a few days, it was showing the same error as you mentioned.

Try to run these commands, might solve your problem.

  • bin/pg_ctl -D demoDataBase -l logfile start
  • bin/psql demoDataBase
  • CREATE EXTENSION age;
  • LOAD 'age';
  • SET search_path = ag_catalog, "$user", public;
  • npm run setup
  • npm run start and it will redirect to http://localhost:3000/