Feb 25, 2025
0
Level 2
Sail, Telescope - cannot resolve hostname
have this odd problem where I am getting error messages in my laravel log:
[previous exception] [object] (PDOException(code: 7): SQLSTATE[08006] [7] could not translate host name \"pgsql\" to address: Name or service not known at /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:66)
[stacktrace]
#0 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(66): PDO->__construct()
#1 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(85): Illuminate\\Database\\Connectors\\Connector->createPdoConnection()
#2 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(48): Illuminate\\Database\\Connectors\\Connector->tryAgainIfCausedByLostConnection()
#3 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Database/Connectors/PostgresConnector.php(35): Illuminate\\Database\\Connectors\\Connector->createConnection()
#4 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(185): Illuminate\\Database\\Connectors\\PostgresConnector->connect()
#5 [internal function]: Illuminate\\Database\\Connectors\\ConnectionFactory->Illuminate\\Database\\Connectors\\{closure}()
#6 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1231): call_user_func()
#7 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Database/Connection.php(565): Illuminate\\Database\\Connection->getPdo()
#8 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Database/Connection.php(812): Illuminate\\Database\\Connection->Illuminate\\Database\\{closure}()
#9 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Database/Connection.php(979): Illuminate\\Database\\Connection->runQueryCallback()
#10 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Database/Connection.php(958): Illuminate\\Database\\Connection->tryAgainIfCausedByLostConnection()
#11 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Database/Connection.php(781): Illuminate\\Database\\Connection->handleQueryException()
#12 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Database/Connection.php(560): Illuminate\\Database\\Connection->run()
#13 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Database/Connection.php(524): Illuminate\\Database\\Connection->statement()
#14 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3717): Illuminate\\Database\\Connection->insert()
#15 /var/www/vhosts/pendock/api/vendor/laravel/telescope/src/Storage/DatabaseEntriesRepository.php(145): Illuminate\\Database\\Query\\Builder->insert()
#16 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(261): Laravel\\Telescope\\Storage\\DatabaseEntriesRepository->Laravel\\Telescope\\Storage\\{closure}()
#17 /var/www/vhosts/pendock/api/vendor/laravel/telescope/src/Storage/DatabaseEntriesRepository.php(144): Illuminate\\Support\\Collection->each()
#18 /var/www/vhosts/pendock/api/vendor/laravel/telescope/src/Telescope.php(661): Laravel\\Telescope\\Storage\\DatabaseEntriesRepository->store()
#19 [internal function]: Laravel\\Telescope\\Telescope::Laravel\\Telescope\\{closure}()
#20 /var/www/vhosts/pendock/api/vendor/laravel/telescope/src/Telescope.php(286): call_user_func()
#21 /var/www/vhosts/pendock/api/vendor/laravel/telescope/src/Telescope.php(653): Laravel\\Telescope\\Telescope::withoutRecording()
#22 /var/www/vhosts/pendock/api/vendor/laravel/telescope/src/ListensForStorageOpportunities.php(65): Laravel\\Telescope\\Telescope::store()
#23 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Laravel\\Telescope\\Telescope::Laravel\\Telescope\\{closure}()
#24 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Container/Util.php(43): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#25 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(83): Illuminate\\Container\\Util::unwrapIfClosure()
#26 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#27 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Container/Container.php(696): Illuminate\\Container\\BoundMethod::call()
#28 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1452): Illuminate\\Container\\Container->call()
#29 /var/www/vhosts/pendock/api/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(219): Illuminate\\Foundation\\Application->terminate()
#30 Command line code(1): Illuminate\\Foundation\\Console\\Kernel->terminate()
#31 {main}
"}
The application seems to work and Telescope also seems to be working, but I still get the error. What is going on here and how do I fix it?
Hosts file:
192.168.2.13 host.docker.internal
192.168.2.13 gateway.docker.internal
127.0.0.1 kubernetes.docker.internal
the DB_HOST is set to pgsql in .env The error gets logged every minute or so, it appears to be telescope causing the error, as if I change the DB_HOST in telescope.config , the error reflects the new host name.
trying different (resolvable) host names in the .env has no effect (host.docker.internal, localhost, 127.0.0.1 - etc)
It does not appear to be an urgent issue as everything (including telescope) still works.....
Please or to participate in this conversation.