Help with Node.js and PostgreSQL

cPanel & WHM Version
86.0.27

Jucester

Registered
Oct 5, 2020
3
0
1
Venezuela
cPanel Access Level
Root Administrator
Good day people, hope you all are doing well.

I need your help. To give context, I bought a Namecheap Stellar Plus Service with the intention of hosting Node, js application, mainly for the price because the budget is very low. My first attempt was good, I can upload the app and it keeps running well, the problems come when I tried to access the PostgreSQL Database I made using the wizard of the cPanel. I really don't know where is the error because I don't have access to logs in real-time.

I'm using Sequelize with this config file:

const sequelize = new Sequelize(
'the_database_name',
'the_database_user'',
'password_of_database_user',
{
host: '127.0.0.1',
dialect: 'postgres',
pool: {
max: 5,
min: 0,
require: 30000,
idle: 10
}
}
);


It's the first time I use phpPgAdmin and when I open it I feel a bit lost because I see things differently than the initial configuration... Like, I'm login with a default user and I can't access the default postgre superuser (I don't know the default password).

Can someone give me guidance to get my node.js app connected with the PostgreSQL Database?
 

cPSamuelM

Technical Analyst Team Lead
Staff member
Nov 20, 2019
196
37
103
USA
cPanel Access Level
Root Administrator
Hello @Jucester

Can you please clarify whether the issue you are observing is with phpPgAdmin or with the Sequelize application?

For phpPgAdmin, you likely would not be able to access this as the superuser as you are using a shared hosting package. Only the server administrator would be able to manage the default Postgres password at the root level.

For connecting your Sequelize app to the Postgres database, you would need to make sure you assigned the correct database name, database user, and database user password in the config file. These settings are managed on the PostgreSQL Databases page in cPanel:

https://docs.cpanel.net/cpanel/databases/postgresql-databases/

Since Sequelize is a Node.js application, can you let us know if the documentation on the following page helps?

https://docs.cpanel.net/knowledge-b...js-application/#install-a-node-js-application
 

Jucester

Registered
Oct 5, 2020
3
0
1
Venezuela
cPanel Access Level
Root Administrator
Hello @cPSamuel, thanks four your answer.

The problem is that my application is not connecting to the database. Or at least I think so.

When I click on the links that use routes to the endpoints that query the database, I get this:

"Incomplete response received from application"

Just for testing, I made a database with ElephantSQL and I can access it with my application locally with no problem, but in cPanel the same thing happens. It's like my app can't finish authenticating. Is there a way to debug the app with SSH? As you may see, It's the first time I'm using cPanel to host an app.
 

Jucester

Registered
Oct 5, 2020
3
0
1
Venezuela
cPanel Access Level
Root Administrator
Hi @cPanelChris

In my var folder there are just cPanel with empty directories, but in the root I have a logs folder and inside it a ssl_log file.

1602340059304.png

In that ssl_log shows all the access to my app and apparently, when I try to access the routes that query the database, I get this:

xxx.xx.xxx.xx - - [09/Oct/2020:01:21:55 -0400] "GET /products HTTP/1.1" 502 54