-
Description:When queueing jobs with a model, the queued job model id becomes 0 which resulted in the actual queued job not being able to be processed. It doesn't happen all the time, but it happened frequently enough to become a problem for me. This happened right after I upgraded Laravel to 9.43.0. Previously it was working 100% of the time Steps To Reproduce:I merely queue it the normal way. app(SendTelegramMessage::class)
->dispatch($log); I have no idea how to troubleshoot further as it's not happening all the time. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 25 replies
-
What is the schema for Can you share code your for this job? Specially constructor |
Beta Was this translation helpful? Give feedback.
-
Hello, Thanks for replying! Here's the Schema for MessageLog Table Schema::create('message_logs', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->nullable()->constrained()->onDelete('cascade');
$table->string('channel')->index();
$table->string('source')->index();
$table->text('message')->nullable();
$table->text('referrer')->nullable();
$table->json('payload')->nullable();
$table->json('headers')->nullable();
$table->timestamps();
}); Just a very typical model. I dispatched the job using the following code as stated above app(SendTelegramMessage::class)
->dispatch($log); The constructor for the jobs looks like this <?php
namespace App\Jobs;
class SendTelegramMessage implements ShouldQueue
{
use Dispatchable;
use InteractsWithQueue;
use Queueable;
use SerializesModels;
/**
* @var TelegramChat
*/
public $log;
/**
* Create a new job instance.
*
* @param MessageLog $log
*/
public function __construct(MessageLog $log)
{
$this->queue = 'message';
$this->log = $log;
}
} Hope it helps! |
Beta Was this translation helpful? Give feedback.
-
I am having the same issue... no idea what the cause is. It seems to happen randomly. @jasontxf any luck fixing it? |
Beta Was this translation helpful? Give feedback.
oh wow! How did I miss such an important issue.
I didn't think Telescope could be the one causing it!
Thanks for sharing.
I am indeed using Telescope.
I'm going to try their solution one by one and see if any works for me.
Today I will reviewed telescope config file and updated be the same as the latest version.
If it doesn't work I'll move to step 2 and eventually step 3.
Cross-finger one of the solutions will work!
@lioneaglesolutions have you tried any of the solution? Did it work?