laravel-filemanager icon indicating copy to clipboard operation
laravel-filemanager copied to clipboard

AWS S3 responds with 500 on folders with a lot of files

Open emyasnikov opened this issue 3 years ago • 5 comments

After upgrade from Laravel 8 to 9 and accordingly Flysystem 1.x to 3 filemanager doesn't work with folders with a lot of files since league/flysystem-cached-adapter packages can't be installed anymore.

[2022-05-04 13:08:15] local.ERROR: Unable to retrieve the last_modified for file at location: files/shares.  {"userId":1,"exception":"[object] (League\\Flysystem\\UnableToRetrieveMetadata(code: 0): Unable to retrieve the last_modified for file at location: files/shares.  at .../vendor/league/flysystem/src/UnableToRetrieveMetadata.php:49)

Please check the following instructions before submitting a bug :

And provide the followings :

  • Operating system : MacOS 12.3.1
  • Laravel version : 9.9.0
  • Package version : 2.4.1
  • Steps to reproduce your issue : Use disk s3 and put folder_name with a lot of files
  • Screenshots of browser console :
Request URL: http://localhost.pim/laravel-filemanager/jsonitems?working_dir=&type=&sort_type=alphabetic&page=1&_=1651673105245
Request Method: GET
Status Code: 500 Internal Server Error
Remote Address: 127.0.0.1:80
Referrer Policy: strict-origin-when-cross-origin

emyasnikov avatar May 04 '22 14:05 emyasnikov

I can confirm that this isn't working, running into the same issue after upgrading from Laravel 8 to Laravel 9

jorenvh avatar Jun 01 '22 13:06 jorenvh

I looked into this issue a bit more and it seems that it only occurs with folders that contain subfolders. It seems like something has changed in the behavior of flystem that is causing this.

jorenvh avatar Jun 01 '22 14:06 jorenvh

This appears to happen to me because lfm is trying to get the last_modified attribute of directories, which s3 doesn't provide.

My error as followed with a directory containing subfolders:

Unable to retrieve the last_modified for file at location:

It appears to be very similar to the issue noted over on flysystem's repository, however it has been closed as not compelling enough to resolve: https://github.com/thephpleague/flysystem/issues/1343

It seems that lfm would need to check if the item is a directory when filling the item_column attributes, and remove time from that list for directory items.

Possible Workaround: Remove time from item_columns in the lfm.php config file. This works for me.

lildigiman avatar Aug 15 '22 18:08 lildigiman

would be great if this gets solved soon

thanks

hmawla avatar Nov 15 '22 13:11 hmawla

@lildigiman it worked well, but when I open the filemanager it shows 'Invalid date' under the name of each file. I know that removing time from item_columns will affect the filemanager. But anyone know how to solve it?

mrobbizulfikar avatar Jan 18 '23 02:01 mrobbizulfikar