Closed spont4e closed 2 months ago
Do you know if it worked with Laravel 9 and laravel-mongodb 3.9? I'd like to determine whether it's a regression or a new feature or a need for documentation.
@GromNaN I don't know... But I can test it
@GromNaN Same problem here
Tracked in PHPORM-87 (duplicated in PHPORM-97)
@spont4e Have you checked file "config/queue.php".
Make sure in "connections"->"database"->["driver"=> "mongodb"].
@spont4e Have you checked file "config/queue.php".
Make sure in "connections"->"database"->["driver"=> "mongodb"].
Yes, Everything was configured properly.
is there any new news about this, we are already in laravel 11 and the error still persists when the default connection is MongoDB.
We tentatively plan to work on this in the next month (April 2024).
Hello!! Any news?
This was part of the 4.3 release. https://www.mongodb.com/docs/drivers/php/laravel-mongodb/current/queues/
Description:
Laravel queue doesn't work when mongodb is the default database driver.
Steps to reproduce
.env
>DB_CONNECTION=mongodb
.env
>QUEUE_CONNECTION=database
php8.2 artisan queue:work --queue=high,default,low --sleep=3 --tries=3 --daemon
Expected behaviour
storage/logs/laravel.log
to be clean.Actual behaviour
storage/logs/laravel.log
contains error.Logs:
``` [2023-09-25 13:24:51] local.ERROR: Call to a member function getAttribute() on null {"exception":"[object] (Error(code: 0): Call to a member function getAttribute() on null at /var/www/vendor/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php:258) [stacktrace] #0 /var/www/vendor/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php(239): Illuminate\\Queue\\DatabaseQueue->getLockForPopping() #1 /var/www/vendor/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php(224): Illuminate\\Queue\\DatabaseQueue->getNextAvailableJob() #2 /var/www/vendor/mongodb/laravel-mongodb/src/Concerns/ManagesTransactions.php(101): Illuminate\\Queue\\DatabaseQueue->Illuminate\\Queue\\{closure}() #3 /var/www/vendor/mongodb/mongodb/src/Operation/WithTransaction.php(64): MongoDB\\Laravel\\Connection->MongoDB\\Laravel\\Concerns\\{closure}() #4 /var/www/vendor/mongodb/mongodb/src/functions.php(496): MongoDB\\Operation\\WithTransaction->execute() #5 /var/www/vendor/mongodb/laravel-mongodb/src/Concerns/ManagesTransactions.php(107): MongoDB\\with_transaction() #6 /var/www/vendor/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php(227): MongoDB\\Laravel\\Connection->transaction() #7 /var/www/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(349): Illuminate\\Queue\\DatabaseQueue->pop() #8 /var/www/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(363): Illuminate\\Queue\\Worker->Illuminate\\Queue\\{closure}() #9 /var/www/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(163): Illuminate\\Queue\\Worker->getNextJob() #10 /var/www/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(138): Illuminate\\Queue\\Worker->daemon() #11 /var/www/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(121): Illuminate\\Queue\\Console\\WorkCommand->runWorker() #12 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Queue\\Console\\WorkCommand->handle() #13 /var/www/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}() #14 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure() #15 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod() #16 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call() #17 /var/www/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\\Container\\Container->call() #18 /var/www/vendor/symfony/console/Command/Command.php(326): Illuminate\\Console\\Command->execute() #19 /var/www/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\\Component\\Console\\Command\\Command->run() #20 /var/www/vendor/symfony/console/Application.php(1081): Illuminate\\Console\\Command->run() #21 /var/www/vendor/symfony/console/Application.php(320): Symfony\\Component\\Console\\Application->doRunCommand() #22 /var/www/vendor/symfony/console/Application.php(174): Symfony\\Component\\Console\\Application->doRun() #23 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\\Component\\Console\\Application->run() #24 /var/www/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle() #25 {main} "} ```