I'm using queueImport to import from csv to DB. The issue I'm facing is that when I import the csv and it will successfully imported the first batch of chunk but in the second chunk I get an error of unlink(/tmp/laravel-excel-ngc7Tv0LIfFIuRWZeaMNMgNzh6PEmUSw): Operation not permitted. I also tested and copied the commit of this issue #2434 to my project but the error still persist.
It only errors on production when the php artisan queue:work is called from the cronjob of www-data but when I call php artisan queue:work on the root folder there is no problem at all. Running in bitnami aws ubuntu, perfectly fine in development environment, windows;
public function chunkSize(): int
{
return 1000;
}
public function registerEvents(): array
{
return [
BeforeImport::class => function(BeforeImport $event) {
Log::info('Importing inventory');
Cache::set('importing-inventory-'.$this->store->id, true);
},
];
}
(/tmp/laravel-excel-ngc7Tv0LIfFIuRWZeaMNMgNzh6PEmUSw): Operation not permitted {"exception":"[object] (ErrorException(code: 0): unlink(/tmp/laravel-excel-ngc7Tv0LIfFIuRWZeaMNMgNzh6PEmUSw): Operation not permitted at /opt/bitnami/apache2/htdocs/inventory/app/vendor/maatwebsite/excel/src/Files/LocalTemporaryFile.php:46)
[stacktrace]
#0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'unlink(/tmp/lar...', '/opt/bitnami/ap...', 46, Array)
#1 /opt/bitnami/apache2/htdocs/amazon-inventory-management/restock-manager-app/vendor/maatwebsite/excel/src/Files/LocalTemporaryFile.php(46): unlink('/tmp/laravel-ex...')
#2 /opt/bitnami/apache2/htdocs/amazon-inventory-management/restock-manager-app/vendor/maatwebsite/excel/src/Reader.php(420): Maatwebsite\\Excel\\Files\\LocalTemporaryFile->delete()
#3 /opt/bitnami/apache2/htdocs/amazon-inventory-management/restock-manager-app/vendor/maatwebsite/excel/src/Reader.php(248): Maatwebsite\\Excel\\Reader->garbageCollect()
This problem happened to me but on the localhost and I solved the problem by changing the permission of the "/tmp/" directory using the following command
sudo chmod -R 777 /tmp/
@OmarAbdelaziz646 thank you sir. That鈥檚 what I did.
This problem happened to me but on the localhost and I solved the problem by changing the permission of the "/tmp/" directory using the following command
sudo chmod -R 777 /tmp/
This worked for me. Thanks ! :)
Most helpful comment
This problem happened to me but on the localhost and I solved the problem by changing the permission of the "/tmp/" directory using the following command
sudo chmod -R 777 /tmp/