Skip to content

Unable to JSON encode payload. Error code: 5 #55

@devinfd

Description

@devinfd

Thank you for your work on this package! I've been fighting an issue for the past week that I can't find a resolution to. I don't know if this is an issue with this package or Laravel but I thought that I would start here.

I have a queued job that has an object (not a model) as constructor argument. The object has property that is a model with a coordinates (Point) attribute.

something like:

class Report
{
  $account = null;
  public function __construct(Model $account) {
    $this->account = $account
  }
}

$account = Account::first();
MakeReport::dispatch(new Report($account));

The coordinates attribute is properly casted on the Account model

protected $casts = [
    'coordinates' => Point::class
];

The problem is that the coordinates are not being serialized by laravel and I get the error:
Illuminate\ Queue\ InvalidPayloadException Unable to JSON encode payload. Error code: 5

Any ideas? I'm starting to lose my mind on this.

PHP 8.1.10
Laravel 9.28.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions