Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Logging Issue: Telescope Fails Host Resolution Every Minute with Sail #752

Open
pejeio opened this issue Nov 7, 2024 · 3 comments

Comments

@pejeio
Copy link

pejeio commented Nov 7, 2024

Telescope Version

5.2.4

Laravel Version

11.29.0

PHP Version

8.3.12

Database Driver & Version

image: 'postgres:17' (the issue also appears on 'mysql/mysql-server:8.0')

Description

While using Laravel Telescope with Laravel Sail, the following error is logged exactly every minute:

[2024-11-07 18:04:23] local.ERROR: SQLSTATE[08006] [7] could not translate host name "pgsql" to address: nodename nor servname provided, or not known
(Connection: pgsql, SQL: insert into "telescope_entries" ("batch_id", "content", "created_at", "family_hash", "type", "uuid") 
values (
    9d6f0be3-4c33-4513-a16e-2bc8b022c141, 
    {
        "command": "list",
        "exit_code": 0,
        "arguments": {
            "command": "list",
            "namespace": null
        },
        "options": {
            "raw": false,
            "format": "txt",
            "short": false,
            "help": false,
            "quiet": false,
            "verbose": false,
            "version": false,
            "ansi": null,
            "no-interaction": false,
            "env": null
        },
        "hostname": "iMac.local"
    }, 
    2024-11-07 18:04:23, 
    ?, 
    command, 
    9d6f0be3-4b2d-4fe8-8f64-73005be78147
)) 
{"exception": "[object] (Illuminate\\Database\\QueryException(code: 7): SQLSTATE[08006] [7] could not translate host name \"pgsql\" to address: nodename nor servname provided, or not known 
(Connection: pgsql, SQL: insert into \"telescope_entries\" (\"batch_id\", \"content\", \"created_at\", \"family_hash\", \"type\", \"uuid\") 
values (
    9d6f0be3-4c33-4513-a16e-2bc8b022c141, 
    {
        \"command\": \"list\",
        \"exit_code\": 0,
        \"arguments\": {
            \"command\": \"list\",
            \"namespace\": null
        },
        \"options\": {
            \"raw\": false,
            \"format\": \"txt\",
            \"short\": false,
            \"help\": false,
            \"quiet\": false,
            \"verbose\": false,
            \"version\": false,
            \"ansi\": null,
            \"no-interaction\": false,
            \"env\": null
        },
        \"hostname\": \"iMac.local\"
    }, 
    2024-11-07 18:04:23, 
    ?, 
    command, 
    9d6f0be3-4b2d-4fe8-8f64-73005be78147
)) at /Users/my-user/my-project/vendor/laravel/framework/src/Illuminate/Database/Connection.php:825

This error clutters the logs but doesn't affect Telescope's functionality otherwise. The issue appears in projects configured to use both MySQL and PostgreSQL databases.

Expected Behavior: No unnecessary or repeated error logs should appear when Telescope is working as expected.

Let me know if further details are required. Thank you!

Steps To Reproduce

@pejeio
Copy link
Author

pejeio commented Nov 7, 2024

Update: Issue Resolved

Adding 127.0.0.1 host.docker.internal to my /etc/hosts file and setting DB_HOST to host.docker.internal in my .env file resolved the issue. It seems Docker wasn’t automatically adding this entry.

Not sure where to report this—should Laravel Sail address this? I noticed in their docker-compose.yml the following:

extra_hosts:
    - 'host.docker.internal:host-gateway'

More info: https://github.com/laravel/sail/blob/1.x/stubs/docker-compose.stub#L11

Could this be causing the issue? Would appreciate any thoughts on this.

@pejeio
Copy link
Author

pejeio commented Nov 7, 2024

New Issue After Stopping Containers

After stopping all containers of my Laravel application using sail down, I now see the following log every minute:

[2024-11-07 22:08:19] local.ERROR: SQLSTATE[08006] [7] connection to server at "host.docker.internal" (127.0.0.1), port 5432 failed: Connection refused

I cannot understand how there is still a process running that’s adding log entries to my laravel.log file when all containers have been stopped. I even stopped Docker Desktop completely. There’s no active service running, yet it seems something is still trying to connect to the database.

@duohaystack
Copy link

Can confirm, same here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants