You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ErrorException]
Trying to get property of non-object
The Laravel RetryCommand->retryJob($job) function is expecting the $job param to be a stdClass (instead of an array).
When using mongo, under the hood the MongoFailedJobProvider class (from MongodbQueueServiceProvider) calls the find() function to retrieve a single failed job, which returns an array (instead of an stdClass).
This type mismatch appears to be the problem.
A similar problem exists at (#1059) - namely, the laravel-mongodb query builder returns an array rather than an stdClass when performing db operations such as find(), get() first(), etc.
A quick fix I would suggest would be to make MongodbQueueServiceProvider work with the Laravel queue command, by casting inside the find() function in the MongoFailedJobProvider class, like so:
/**
* Get a single failed job.
*
* @param mixed $id
* @return stdClass
*/
public function find($id)
{
$job = $this->getTable()->find($id);
$job['id'] = (string) $job['_id'];
// CAST HERE
return (object)$job;
}
@jenssegers, I would appreciate any suggestions on the proposed fix, I am happy to make a pull request for it.
Thanks
The text was updated successfully, but these errors were encountered:
Hi,
It appears that retrying failed jobs, using mongodb, does not work. I configured my environment as described in (https://github.com/jenssegers/laravel-mongodb#queues), project versions below:
The error I receive is:
The Laravel
RetryCommand->retryJob($job)
function is expecting the$job
param to be astdClass
(instead of anarray
).When using mongo, under the hood the
MongoFailedJobProvider
class (fromMongodbQueueServiceProvider
) calls thefind()
function to retrieve a single failed job, which returns anarray
(instead of anstdClass
).This type mismatch appears to be the problem.
A similar problem exists at (#1059) - namely, the
laravel-mongodb
query builder returns anarray
rather than anstdClass
when performing db operations such as find(), get() first(), etc.A quick fix I would suggest would be to make
MongodbQueueServiceProvider
work with the Laravel queue command, by casting inside thefind()
function in theMongoFailedJobProvider
class, like so:@jenssegers, I would appreciate any suggestions on the proposed fix, I am happy to make a pull request for it.
Thanks
The text was updated successfully, but these errors were encountered: