amir9480/vscode-laravel-extra-intellisense

Error running in Docker

Opened this issue · 1 comments

Hi.

I am running a Laravel app in Docker. When starting the extension I get a number of errors.

app_db is the Docker service name.

The errors are all of the same type, namely:

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for app_db failed: nodename nor servname provided, or not known

The full log is below.

Any thoughts on how to fix this?

VS Code: 1.92.0
Extension: v0.6.6
Logs:

2024-08-08 11:58:22.066 [info] Laravel Extra Intellisense Started...
2024-08-08 11:58:22.066 [info] Laravel Extra Intellisense command started: HTTP Routes
2024-08-08 11:58:22.066 [info] Laravel Extra Intellisense command started: Views paths
2024-08-08 11:58:22.066 [info] Laravel Extra Intellisense command started: Configs
2024-08-08 11:58:22.066 [info] Laravel Extra Intellisense command started: Translation namespaces
2024-08-08 11:58:22.066 [info] Laravel Extra Intellisense command started: Middlewares
2024-08-08 11:58:22.066 [info] Laravel Extra Intellisense command started: Application Models
2024-08-08 11:58:22.066 [info] Laravel Extra Intellisense command started: Auth Data
2024-08-08 11:58:22.067 [info] Laravel Extra Intellisense command started: Eloquent Attributes and Relations
2024-08-08 11:58:22.067 [info] Laravel Extra Intellisense command started: Custom Blade Directives
2024-08-08 11:58:23.730 [error] Laravel Extra Intellisense Error:
 Views paths
   PDOException 
  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for app_db failed: nodename nor servname provided, or not known
  at [internal]:0
      1▕
      �[2m+9 vendor frames �[22m
  10  app/Core/Providers/AppServiceProvider.php:141
      Illuminate\Database\Connection::getDoctrineConnection()
  11  app/Core/Providers/AppServiceProvider.php:54
      App\Core\Providers\AppServiceProvider::addDbalTypes()
2024-08-08 11:58:23.730 [error] Laravel Extra Intellisense Error:
 Auth Data
   PDOException 
  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for app_db failed: nodename nor servname provided, or not known
  at [internal]:0
      1▕
      �[2m+9 vendor frames �[22m
  10  app/Providers/AppServiceProvider.php:141
      Illuminate\Database\Connection::getDoctrineConnection()
  11  app/Providers/AppServiceProvider.php:54
      App\Providers\AppServiceProvider::addDbalTypes()
2024-08-08 11:58:23.730 [error] Laravel Extra Intellisense Error:
 Translation namespaces
   PDOException 
  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for app_db failed: nodename nor servname provided, or not known
  at [internal]:0
      1▕
      �[2m+9 vendor frames �[22m
  10  app/Providers/AppServiceProvider.php:141
      Illuminate\Database\Connection::getDoctrineConnection()
  11  app/Providers/AppServiceProvider.php:54
      App\Providers\AppServiceProvider::addDbalTypes()
2024-08-08 11:58:23.731 [error] Laravel Extra Intellisense Error:
 Configs
   PDOException 
  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for app_db failed: nodename nor servname provided, or not known
  at [internal]:0
      1▕
      �[2m+9 vendor frames �[22m
  10  app/Providers/AppServiceProvider.php:141
      Illuminate\Database\Connection::getDoctrineConnection()
  11  app/Providers/AppServiceProvider.php:54
      App\Providers\AppServiceProvider::addDbalTypes()
2024-08-08 11:58:23.731 [error] Laravel Extra Intellisense Error:
 Application Models
   PDOException 
  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for app_db failed: nodename nor servname provided, or not known
  at [internal]:0
      1▕
      �[2m+9 vendor frames �[22m
  10  app/Providers/AppServiceProvider.php:141
      Illuminate\Database\Connection::getDoctrineConnection()
  11  app/Providers/AppServiceProvider.php:54
      App\Providers\AppServiceProvider::addDbalTypes()
2024-08-08 11:58:23.731 [error] Laravel Extra Intellisense Error:
 Custom Blade Directives
   PDOException 
  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for app_db failed: nodename nor servname provided, or not known
  at [internal]:0
      1▕
      �[2m+9 vendor frames �[22m
  10  app/Providers/AppServiceProvider.php:141
      Illuminate\Database\Connection::getDoctrineConnection()
  11  app/Providers/AppServiceProvider.php:54
      App\Providers\AppServiceProvider::addDbalTypes()
2024-08-08 11:58:23.731 [error] Laravel Extra Intellisense Error:
 HTTP Routes
   PDOException 
  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for app_db failed: nodename nor servname provided, or not known
  at [internal]:0
      1▕
      �[2m+9 vendor frames �[22m
  10  app/Providers/AppServiceProvider.php:141
      Illuminate\Database\Connection::getDoctrineConnection()
  11  app/Providers/AppServiceProvider.php:54
      App\Providers\AppServiceProvider::addDbalTypes()
2024-08-08 11:58:23.731 [error] Laravel Extra Intellisense Error:
 Eloquent Attributes and Relations
   PDOException 
  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for app_db failed: nodename nor servname provided, or not known
  at [internal]:0
      1▕
      �[2m+9 vendor frames �[22m
  10  app/Providers/AppServiceProvider.php:141
      Illuminate\Database\Connection::getDoctrineConnection()
  11  app/Providers/AppServiceProvider.php:54
      App\Providers\AppServiceProvider::addDbalTypes()
2024-08-08 11:58:23.732 [error] Laravel Extra Intellisense Error:
 Middlewares
   PDOException 
  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for app_db failed: nodename nor servname provided, or not known
  at [internal]:0
      1▕
      �[2m+9 vendor frames �[22m
  10  app/Providers/AppServiceProvider.php:141
      Illuminate\Database\Connection::getDoctrineConnection()
  11  app/Providers/AppServiceProvider.php:54
      App\Providers\AppServiceProvider::addDbalTypes()

check LaravelExtraIntellisense.phpCommand. it should be docker compose exec -w /var/www/html app_container_name php -r "{code}"
Don't forget to replace app_container_name with your Docker service name of the app itself