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

CLI DB session not working on read/write connections #37520

Closed
l-alexandrov opened this issue May 28, 2021 · 5 comments · Fixed by #37530 or #37548
Closed

CLI DB session not working on read/write connections #37520

l-alexandrov opened this issue May 28, 2021 · 5 comments · Fixed by #37530 or #37548

Comments

@l-alexandrov
Copy link

  • Laravel Version: 8.34.0
  • PHP Version: 8.0.6
  • Database Driver & Version: mysql 10.4

Description:

When the connection has different hosts for read/write, the command php artisan db doesn't work. It gives error:

ErrorException 
Undefined array key "host"

Steps To Reproduce:

  1. Create a new read/write connection as described here.
  2. Make it your default connection
  3. Run php artisan db
  4. See the error
@driesvints
Copy link
Member

Can you try the latest version? We recently did a fix for read/write connections.

@l-alexandrov
Copy link
Author

I tried with 8.44.0 and I am receiving the same error. My configuration is as follows:
Screenshot_20210528_164835

@themsaid
Copy link
Member

We need a full stack trace of the exception.

@l-alexandrov
Copy link
Author

l-alexandrov commented May 28, 2021

[root@myPC Project]$ php artisan db -vvv

   ErrorException 

  Undefined array key "host"

  at vendor/laravel/framework/src/Illuminate/Database/Console/DbCommand.php:125
    121▕      */
    122▕     protected function getMysqlArguments(array $connection)
    123▕     {
    124▕         return array_merge([
  ➜ 125▕             '--host='.$connection['host'],
    126▕             '--port='.$connection['port'],
    127▕             '--user='.$connection['username'],
    128▕         ], $this->getOptionalArguments([
    129▕             'password' => '--password='.$connection['password'],

  1   vendor/laravel/framework/src/Illuminate/Database/Console/DbCommand.php:125
      Illuminate\Foundation\Bootstrap\HandleExceptions::handleError()

  2   vendor/laravel/framework/src/Illuminate/Database/Console/DbCommand.php:80
      Illuminate\Database\Console\DbCommand::getMysqlArguments()

  3   vendor/laravel/framework/src/Illuminate/Database/Console/DbCommand.php:36
      Illuminate\Database\Console\DbCommand::commandArguments()

  4   vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
      Illuminate\Database\Console\DbCommand::handle()

  5   vendor/laravel/framework/src/Illuminate/Container/Util.php:40
      Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()

  6   vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
      Illuminate\Container\Util::unwrapIfClosure()

  7   vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37
      Illuminate\Container\BoundMethod::callBoundMethod()

  8   vendor/laravel/framework/src/Illuminate/Container/Container.php:614
      Illuminate\Container\BoundMethod::call()

  9   vendor/laravel/framework/src/Illuminate/Console/Command.php:136
      Illuminate\Container\Container::call()

  10  vendor/symfony/console/Command/Command.php:256
      Illuminate\Console\Command::execute()

  11  vendor/laravel/framework/src/Illuminate/Console/Command.php:121
      Symfony\Component\Console\Command\Command::run()

  12  vendor/symfony/console/Application.php:971
      Illuminate\Console\Command::run()

  13  vendor/symfony/console/Application.php:290
      Symfony\Component\Console\Application::doRunCommand()

  14  vendor/symfony/console/Application.php:166
      Symfony\Component\Console\Application::doRun()

  15  vendor/laravel/framework/src/Illuminate/Console/Application.php:92
      Symfony\Component\Console\Application::run()

  16  vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:129
      Illuminate\Console\Application::run()

  17  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

@themsaid
Copy link
Member

thanks! Fixed in #37530

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