Jump to content

Recommended Posts

Posted

Hello, I successfully imported my data into the database I created on HelioHost. However, I'm encountering issues when attempting to connect to this database through my API hosted on Fly.io. It results in an error, for which I've included the logs below. Interestingly, the database connection works fine when I try it on my local machine or via SSH. The problem only arises when I attempt to connect through my API.
 

2023-12-26T00:59:51.009 app[3287114c1d3385] gru [info] > tobias-api@1.0.0 start

2023-12-26T00:59:51.009 app[3287114c1d3385] gru [info] > node .

2023-12-26T00:59:51.988 app[3287114c1d3385] gru [info] API Online na porta 3000

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] ConnectionError [SequelizeConnectionError]: connect ETIMEDOUT

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] at ConnectionManager.connect (/app/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:102:17)

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] at async ConnectionManager._connect (/app/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:222:24)

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] at async /app/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:174:32

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] at async ConnectionManager.getConnection (/app/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:197:7)

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] at async /app/node_modules/sequelize/lib/sequelize.js:305:26

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] at async MySQLQueryInterface.select (/app/node_modules/sequelize/lib/dialects/abstract/query-interface.js:407:12)

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] at async Authentication.findAll (/app/node_modules/sequelize/lib/model.js:1140:21)

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] at async Authentication.findOne (/app/node_modules/sequelize/lib/model.js:1240:12)

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] at async findChampionByUsername (/app/src/services/authenticationServices.js:37:10) {

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] parent: Error: connect ETIMEDOUT

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] at Connection._handleTimeoutError (/app/node_modules/mysql2/lib/connection.js:205:17)

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] at listOnTimeout (node:internal/timers:568:17)

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] at process.processTimers (node:internal/timers:511:7) {

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] errorno: 'ETIMEDOUT',

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] code: 'ETIMEDOUT',

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] syscall: 'connect',

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] fatal: true

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] },

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] original: Error: connect ETIMEDOUT

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] at Connection._handleTimeoutError (/app/node_modules/mysql2/lib/connection.js:205:17)

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] at listOnTimeout (node:internal/timers:568:17)

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] at process.processTimers (node:internal/timers:511:7) {

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] errorno: 'ETIMEDOUT',

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] code: 'ETIMEDOUT',

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] syscall: 'connect',

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] fatal: true

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] }

2023-12-26T01:06:41.060 app[3287114c1d3385] gru [info] }
 

Posted

So you can connect to the database remotely from your PC, but Fly.io cannot connect to our server remotely? It's possible the firewall is blocking it on our side.

What IP does the fly.io connection come from, what host name are you using for the database server, and what port?

Posted

fly.io api: "https://tobias-api.fly.dev"
fly.io api IPV4: 66.241.124.251
fly.io api IPV6: 2a09:8280:1::15:69c1
MYSQL_HOST=johnny.heliohost.org
and the default port 3306, but I did not explicitly specify it.

 

Posted (edited)

Not really, my api is on port 3000, but in my .env file, I don't specify that it should connect to port 3000.

MYSQL_HOST=johnny.heliohost.org

I just use this URL, as stated in the docs. The main problem is that when I try to connect to my database hosted on johnny.heliohost.org, I receive the error that I sent above.

It works fine on my local machine, and I can certainly connect using MySQL Workbench. The error only occurs when my API hosted on fly.io tries to connect.

This message regarding port 3000 appears when I start my API. Afterward, when I try to send a request to my database on my site via my API, I receive an 'ETIMEDOUT' error.

Edited by isaacmagno98
Posted (edited)

Update:

I have tried using my API on HelioHost, and it is now online. I am able to access the GET routes. However, my app includes an authentication system, and the POST routes are not working. These features work on my local machine. When I connect to my database locally, I can log in and perform any required actions. But when it is connected via the API (which is currently hosted on HelioHost) at https://tobiasdb.heliohost.us/champions, I receive errors when attempting to log in or make POST requests. If you'd like, you can check it out.

Edited by isaacmagno98
Posted (edited)
2023-12-27 19:42:43 Error 2604:1380:41:1506:0:68e:f6dd:1 500 POST /champion-login HTTP/1.0   undici 1.95 K Apache SSL/TLS access
2023-12-27 19:45:03 Error 2604:1380:41:1506:0:68e:f6dd:1 500 POST /champion-login HTTP/1.0   undici 583 Apache SSL/TLS access
2023-12-27 19:45:25 Error 2604:1380:41:1501:0:f514:6e45:1 500 POST /champion-login HTTP/1.0   undici 583 Apache SSL/TLS access


These are the only logs I have access to; I can't find any others

Edited by isaacmagno98
Posted

I found this
 

App 24494 output: Desenvolvido por Isaac Magno
App 24494 output: API Online na porta 3003
App 24494 output: Error: secretOrPrivateKey must have a value
App 24494 output:     at Object.module.exports [as sign] (/home/tobiasdb.heliohost.us/node_modules/jsonwebtoken/sign.js:111:20)
App 24494 output:     at createJWToken (/home/tobiasdb.heliohost.us/src/services/authenticationServices.js:193:14)
App 24494 output:     at Object.login (/home/tobiasdb.heliohost.us/src/services/authenticationServices.js:214:19)
App 24494 output:     at runNextTicks (node:internal/process/task_queues:61:5)
App 24494 output:     at processImmediate (node:internal/timers:437:9)
App 24494 output:     at async login (/home/tobiasdb.heliohost.us/src/controllers/authenticationController.js:41:24)

Maybe this will help? https://stackoverflow.com/questions/58673430/error-secretorprivatekey-must-have-a-value

Posted (edited)

Where do you see these logs? I'll need this for future reference.

My account got suspended while running a Node.js application. I then removed the API from HelioHost and decided to keep only the database. However, I am still unable to connect to my API, which is hosted on HelioHost. This issue only occurs when I attempt to connect to my API. When I connect from my local machine or MySQL Workbench, it works perfectly.

Edited by isaacmagno98
Posted
10 hours ago, isaacmagno98 said:

I am still unable to connect to my API, which is hosted on HelioHost.

By "my API" do you mean "remote MariaDB access" or what language is your API written in? What port is your API using? SSL over 443? Http over port 80? Remote MariaDB on port 3306?

Posted (edited)

I'm sorry; I wrote it wrong. What I meant to say is that I still can't connect to the database using my API. It's built in Node.js and hosted on fly.io.

I had previously hosted it on HelioHost, but as @wolstech mentioned, it was experiencing a load balance issue, so I removed it from there.

The issue remains the same: I can't access the database with my API hosted on fly.io, but when I run my API locally, it works fine and I can connect with the database.

I trying to do a remote connection with my database hosted in HelioHost.

this is my .env 

# MYSQL_HOST=johnny.heliohost.org
# MYSQL_PORT=3306
# MYSQL_DB_NAME=isaacmagno98_tobiasdb
# MYSQL_USER=########### (is the correct user and password, but the topic is open, then I just blurred this)
# MYSQL_PASSWORD=########

Edited by isaacmagno98
Guest
This topic is now closed to further replies.
×
×
  • Create New...