Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Unable to JSON encode payload. Error code: 5 #4035

Closed
1 task done
lbeauvisage opened this issue Nov 23, 2023 · 2 comments
Closed
1 task done

[Bug]: Unable to JSON encode payload. Error code: 5 #4035

lbeauvisage opened this issue Nov 23, 2023 · 2 comments
Labels

Comments

@lbeauvisage
Copy link

Is the bug applicable and reproducable to the latest version of the package and hasn't it been reported before?

  • Yes, it's still reproducable

What version of Laravel Excel are you using?

3.1.50

What version of Laravel are you using?

9.52.16

What version of PHP are you using?

8.2.9

Describe your issue

I'm facing a problem with the excel file below.

import roduits 23_11.xls

Excel::import(new ProductsImport(), $file);

throw a Illuminate\Queue\InvalidPayloadException exception

when debugging

https://github.com/laravel/framework/blob/99d21f37f100b0c5b6a8d09ab0ed86aad3f4a6c8/src/Illuminate/Queue/Queue.php#L100C5-L116C1

I can see that $job has a lot of data provided by PhpOffice\PhpSpreadsheet\Reader\Xls

Capture d’écran 2023-11-23 à 17 58 43

It's look that this amount of data cause a problem with serialization for the job.

How can the issue be reproduced?

Import Class:

class ProductsImport implements ToCollection, SkipsOnFailure, WithHeadingRow, WithEvents, WithChunkReading, ShouldQueue
{
    use SkipsFailures;
...

.env:

QUEUE_CONNECTION=redis

What should be the expected behaviour?

When I create a new file via libreOffice and paste the dataset then the import works.

I would like to be able to remove meta data from the file before importing

@patrickbrouwers
Copy link
Member

patrickbrouwers commented Nov 29, 2023

Queuing xls is not supported at the moment as noted in the docs; https://docs.laravel-excel.com/3.1/imports/queued.html#notes

You could either make sure the file is always xlsx or don't use the built-in queuing but add a long-running queue job yourself

@lbeauvisage
Copy link
Author

sorry I completely missed this part, and it's not for lack of having reread it several times 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants