public function handle(?string $task = null): void
{
$task = IncomingTask::fromJson($task ?: request()->getContent());
event(new TaskIncoming($task));
if ($task->isInvalid()) {
abort(422, 'Invalid task payload');
}
if (! CloudTasksApi::exists($task->fullyQualifiedTaskName())) {
abort(404);
}
$config = config('queue.connections.'.$task->connection());
$this->config = is_array($config) ? $config : [];
// We want to catch any errors so we have more fine-grained control over
// how tasks are retried. Cloud Tasks will retry the task if a 5xx status
// is returned. Because we manually manage retries by releaseing jobs,
// we never want to return a 5xx status as that will result in duplicate
// job attempts.
rescue(fn () => $this->run($task), report: false);
}
Solution: just ignore report field or set it as true
Hello,
The following implementation https://github.com/stackkit/laravel-google-cloud-tasks-queue/blob/52452fc2648eb2ce9413afedc7770812270e2bef/src/TaskHandler.php#L44C9-L44C15 will never throw an Exception, correctly. The down side of this is that a Stack trace or simply a log of the error will never be printed. Following this pattern, any error logging method (as
Sentry
orMezmo
) will never catch the error.Solution: just ignore
report
field or set it astrue