Reputation: 1904
I repeatedly receive the following error when I try to push a job onto my Laravel Queue:
Argument 1 passed to Illuminate\Queue\Jobs\Job::resolveAndFire() must be of the type array, null given, called in /home/vagrant/Code/project/vendor/laravel/framework/src/Illuminate/Queue/Jobs/BeanstalkdJob.php on line 53 and defined
I have no clue what is going wrong but I'm guessing it's something to do with the fact I haven't used the SerializesModel Trait? When I try to use Serializes model, I just get an undefined property $directory error.
The job class is:
/**
* Class StoreFile
* @package App\Jobs
*/
class StoreFile extends Job implements SelfHandling, ShouldQueue
{
use InteractsWithQueue;
/**
* @param string $directory
* @param string $filename
* @param UploadedFile $file
*/
public function __construct($directory, $filename, $file)
{
$this->directory = $directory;
$this->filename = $filename;
$this->file = $file;
}
/**
* @param FileSystem $storage
* @return boolean
*/
public function handle(FileSystem $storage)
{
$path = $this->directory . $this->filename;
$storage->disk('s3')->put($path, $this->file);
return true;
}
}
UPDATE I queue the job from another class using this:
$this->dispatch(new StoreFile($directory, rawurlencode($filename), file_get_contents($evidence)));
Where $evidence is an UploadedFile. I'm certain that all the variables are set as if I remove the ShouldQueue/InteractsWithQueue the job executes fine
Upvotes: 3
Views: 1857
Reputation: 775
In my case, it was because the jobs tables was having a payload "0" instead of JSON for executing the job.
Upvotes: 0
Reputation: 1
The error can be solved easy. Check: may be you added manualy test message to queue. So, this message can broke your code, because has another structure.
Upvotes: -4