Getaddrinfo failed: Name or service not known

Wappler Version : 3.0.1
Operating System : php 7.3.11

The following error is appearing on a project when calling a server connect action. It SEEMS to occur on the first hit only, as hits after that all work until I leave the project and come back to work later. The server is attempting to connect to a remote database server at digital ocean.

I suspect it is a digital ocean issue, but posting here in case Wappler is not waiting long enough for the connection or something.

{
  "code": 2002,
  "file": "/home/uniqueideas/domains/project_1546/public_html/dmxConnectLib/lib/db/Connection.php",
  "line": 81,
  "message": "SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known",
  "trace": "#0 /home/uniqueideas/domains/project_1546/public_html/dmxConnectLib/lib/db/Connection.php(81): PDO->__construct('mysql:host=db-h...', 'user_name_redacted', 'pass_redacted', Array)\n#1 /home/uniqueideas/domains/project_1546/public_html/dmxConnectLib/modules/dbconnector.php(12): lib\\db\\Connection->__construct(Object(lib\\App), Object(stdClass))\n#2 /home/uniqueideas/domains/project_1546/public_html/dmxConnectLib/lib/App.php(173): modules\\dbconnector->connect(Object(stdClass), 'site_db')\n#3 /home/uniqueideas/domains/project_1546/public_html/dmxConnectLib/lib/App.php(137): lib\\App->execSteps(Object(stdClass))\n#4 /home/uniqueideas/domains/project_1546/public_html/dmxConnectLib/lib/App.php(107): lib\\App->execSteps(Array)\n#5 /home/uniqueideas/domains/project_1546/public_html/pages/app/app.php(19): lib\\App->exec(Object(stdClass), true)\n#6 {main}"
}

Any ideas?

Hey @mebeingken,

Did you ever figure this out?

If I did, I have no idea what the solution was. :slight_smile:

Shocked that you can’t perfectly recall an issue from 1+ year ago.

Maybe this will ring a bell… Do you recall if it had anything to do with Docker hosting?
image

I don’t recall. Generally speak, my experience with DO connections and Wappler has not been great. Always have one type of issue or another, so I probably just stopped trying.

What is your error exactly?

This happens when you have entered manually server name while the ones from docker are generated automatically.

That is why we forbid editing the docker generated database connection settings.

I apologize in advance if this is a stupid thing I’m doing. I’m not a Dev Ops master to say the least.

Here is the exact error:

{"code":2002,"file":"\/home\/site\/wwwroot\/dmxConnectLib\/lib\/db\/Connection.php","line":105,"message":"SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known","trace":"#0 \/home\/site\/wwwroot\/dmxConnectLib\/lib\/db\/Connection.php(105): PDO->__construct('mysql:host=db;p...', 'db_user', 'G1R1kjN2', Array)\n#1 \/home\/site\/wwwroot\/dmxConnectLib\/modules\/dbconnector.php(12): lib\\db\\Connection->__construct(Object(lib\\App), Object(stdClass), 'db')\n#2 \/home\/site\/wwwroot\/dmxConnectLib\/lib\/App.php(195): modules\\dbconnector->connect(Object(stdClass), 'db')\n#3 \/home\/site\/wwwroot\/dmxConnectLib\/lib\/App.php(127): lib\\App->execSteps(Object(stdClass))\n#4 \/home\/site\/wwwroot\/dmxConnectLib\/lib\/App.php(153): lib\\App->exec(Object(stdClass), true)\n#5 \/home\/site\/wwwroot\/dmxConnectLib\/lib\/App.php(159): lib\\App->execSteps(Object(stdClass))\n#6 \/home\/site\/wwwroot\/dmxConnectLib\/lib\/App.php(127): lib\\App->execSteps(Array)\n#7 \/home\/site\/wwwroot\/index.php(19): lib\\App->exec(Object(stdClass), true)\n#8 {main}"}

Are you using a docker database in the target settings and it is running?

@George here is the config:

Well seems you are not using docker at all on this target.

So just select the target and edit your db connection in server connect and enter the right live settings for it.

I’m able to connect to this DB using MySQL Workbench.

You mean like this?

Yes , so what is your server address? Seems it doesn’t exist.

The address is: revcore.mysql.database.azure.com

Well are you sure that is what you have entered and saved? As it seems it can not be found.

Maybe save it and make sure the files are uploaded to your remote server.

Username is hidden for security reasons. However I confirm they are the same.

Here’s the connection success message from the DB client:
image

Here’s the Wappler DB connection:

Just saved the Azure DB connection. Web server is still showing error.

Let me ask you, does the Project Settings hosting type = Docker Hosting mean that all target servers need to be Docker Hosting?

You shouldn’t enter https:// in front it is not a webpage!

3 posts were split to a new topic: Connecting to MySQL on Azure with SSL in PHP