fast-excel icon indicating copy to clipboard operation
fast-excel copied to clipboard

download excel problem in live server

Open alinazir opened this issue 3 years ago • 4 comments

when test it on local server it works fine but when host my application to live server its giving me ERR_INVALID_RESPONSE why?

        return (new FastExcel($list))->download('file.xlsx');

alinazir avatar Sep 07 '21 09:09 alinazir

Same thing started happening for me in on production servers. Noticed it about a month ago.

jvarugh avatar Sep 30 '21 19:09 jvarugh

I have same problem

shahroudi avatar Oct 04 '21 07:10 shahroudi

For what it's worth, I solved this by fixing 2 issues:

First Issue: I was double returning the download, so: return response()->download($fastExcelJob->download($filename));

The $fastExcelJob->download is returned by another class. I had fixed this issue on a few other controllers, but this instance has not been fixed. This issue might not be applicable to everyone.

Second Issue: In my recordGenerator() function (iterator function for all records), I had some helper functions that make certain attributes human readable friendly (example, concat first_name and last_name into one user_name field).

There was an error when trying to render one of these attributes due to missing field values. For some reason, these were not being caught when using the $fastExcelJob->download() method. I caught the errors by switching the $fastExcelJob from download to export: $fastExcelJob->export($filename)

At that point, it started catching the errors and I could see them in the logs. No clue why it didn't do that with download().

Hope this helps someone. Cheers

jvarugh avatar Oct 04 '21 13:10 jvarugh

In my case ZipArchive was not installed on server But there was not error on the page

shahroudi avatar Oct 05 '21 06:10 shahroudi