dimanche 9 juin 2019

Laravel Jobs: Assumed index "job" causing error

I've got a Laravel 5.7 app consuming an SQS queue, populated by an external app to trigger some basic integration tasks.

I'm seeing in my Laravel logs this error:

Undefined index: job at (proj-dir)/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php:234

I can see the Jobs class is assuming a "job" index - but you can't assume that is set... unless the Laravel implementation assumes reading and writing to the SQS queue is handled only by Laravel.

/**
 * Get the name of the queued job class.
 *
 * @return string
 */
public function getName()
{
    return $this->payload()['job'];
}

I'm surprised this hasn't been reported all over the place. Perhaps I'm using it differently than most.

I'm not sure if I need to ask the other provider to specify a job name in the payload, or modify the Laravel core to not assume this is required.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire