TJ Sherrill
TJ Sherrill

Reputation: 2645

Laravel forge Redis setup Undefined index: queue on RedisConnector

I am running Laravel 5.7 on Forge. Things are working well. I have two simple jobs that run. One when a user logs in and one when users want to download a large file.

In my local they both work great. Once deployed on forge they both fail with the same exception:

ErrorException: Undefined index: queue in /home/forge/SITE/vendor/laravel/framework/src/Illuminate/Queue/Connectors/RedisConnector.php:46

The stack trace points right back to the two lines where I call dispatch();

My setup is default for Redis. I have not changed my env or anything else related to a normal redis setup.

Both my local and my prod forge site have:

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

I have no idea why this would happen only in my Forge setup. TIA

-- After continueing to look into this, when I run it locally I have run php artisan queue:work

I tested running this after ssh'ing into my forge server and got this:

 ErrorException  : Undefined index: queue

  at /home/forge/members.spaceangels.com/vendor/laravel/framework/src/Illuminate/Queue/Connectors/RedisConnector.php:46
    42|      */
    43|     public function connect(array $config)
    44|     {
    45|         return new RedisQueue(
    46|             $this->redis, $config['queue'],
    47|             $config['connection'] ?? $this->connection,
    48|             $config['retry_after'] ?? 60,
    49|             $config['block_for'] ?? null
    50|         );

  Exception trace:

  1   Illuminate\Foundation\Bootstrap\HandleExceptions::handleError("Undefined index: queue", "/home/forge/members.spaceangels.com/vendor/laravel/framework/src/Illuminate/Queue/Connectors/RedisConnector.php", [])
      /home/forge/members.spaceangels.com/vendor/laravel/framework/src/Illuminate/Queue/Connectors/RedisConnector.php:46

  2   Illuminate\Queue\Connectors\RedisConnector::connect(["redis"])
      /home/forge/members.spaceangels.com/vendor/laravel/framework/src/Illuminate/Queue/QueueManager.php:157

  Please use the argument -v to see more details.

my config/queue.php setting:

'redis' => [
            'driver' => 'redis',
            'connection' => 'default',
            'queue' => 'default',
            'retry_after' => 90,
            'block_for' => null,
        ],

I feel like this is something missing between my config and how forge enables Redis

Upvotes: 3

Views: 2355

Answers (1)

Gilberto Albino
Gilberto Albino

Reputation: 2745

Well, it seems like your .env file is missing:

CACHE_DRIVER=redis

Upvotes: 2

Related Questions