Eric Qvarnström
Eric Qvarnström

Reputation: 947

Laravel choses wrong queue connection

I've been developing a system for about 2 months now without any problems. However, now when it's time for launch, I did setup a dedicated server and started installing everything that was needed. However, when I came to settung up supervisor, things got ugly.

In my .env file I got this setting:

QUEUE_CONNECTION=database

However, when starting supervisor, I get this error:

{
"class": "Error",
"message": "Class 'Aws\\Sqs\\SqsClient' not found",
"code": 0,
"file": "/var/www/brevia-laravel/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SqsConnector.php:26",
"trace": [
    "/var/www/brevia-laravel/vendor/laravel/framework/src/Illuminate/Queue/QueueManager.php:157",
    "/var/www/brevia-laravel/vendor/laravel/framework/src/Illuminate/Queue/QueueManager.php:138",
    "/var/www/brevia-laravel/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:145",
    "/var/www/brevia-laravel/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php:116",
    "/var/www/brevia-laravel/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php:100",
    "/var/www/brevia-laravel/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36",
    "/var/www/brevia-laravel/vendor/laravel/framework/src/Illuminate/Container/Util.php:40",
    "/var/www/brevia-laravel/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93",
    "/var/www/brevia-laravel/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37",
    "/var/www/brevia-laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php:610",
    "/var/www/brevia-laravel/vendor/laravel/framework/src/Illuminate/Console/Command.php:136",
    "/var/www/brevia-laravel/vendor/symfony/console/Command/Command.php:256",
    "/var/www/brevia-laravel/vendor/laravel/framework/src/Illuminate/Console/Command.php:121",
    "/var/www/brevia-laravel/vendor/symfony/console/Application.php:971",
    "/var/www/brevia-laravel/vendor/symfony/console/Application.php:290",
    "/var/www/brevia-laravel/vendor/symfony/console/Application.php:166",
    "/var/www/brevia-laravel/vendor/laravel/framework/src/Illuminate/Console/Application.php:93",
    "/var/www/brevia-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:129",
    "

I've tried to do cache:clear and config:clear, but still the worker thinks that I want to run the SqsQueue and not the database-queue... Tried looking around but can't find anyone with a similar problem.

I'm running Ubuntu 18.04 and PHP 7.3.26

EDIT

Running the command:

php artisan queue:work

works, so the problem might be the supervisor setup...

Upvotes: 2

Views: 1842

Answers (3)

Neil Acero
Neil Acero

Reputation: 146

I ran into this same issue, and just realized the config I copied directly from Laravel's Queue documentation had sqs as a php artisan parameter

command=php /home/forge/app.com/artisan queue:work sqs --sleep=3 --tries=3 --max-time=3600

I did change the artisan location, but somehow the sqs parameter escaped me.

I just removed it and the worker ran just as expected.

Upvotes: 2

Eric Qvarnström
Eric Qvarnström

Reputation: 947

Found the error. When I started the supervisor it turns out that I had put the wrong flag by misstake. This forced the worker to run AWS instead of the setting in the .env

Upvotes: 1

Sergey Zakharevich
Sergey Zakharevich

Reputation: 390

Add to .env QUEUE_DRIVER=database

And add fix the construction in config file ~/config/queue.php to

[
    'default' => env('QUEUE_DRIVER', 'sync'),
     ....
      ....
]

Upvotes: 2

Related Questions