1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Error with Temporary File Storage in Multi-Instance Auto-Scaling Environment and Inquiry on...

Discussão em 'Outras Linguagens' iniciado por Noor Yasser, Novembro 5, 2024 às 18:02.

  1. Noor Yasser

    Noor Yasser Guest

    I'm encountering an issue when using auto-scaling, particularly when my application scales to more than one instance. After auto-scaling, I start seeing the following error when trying to export files:

    {
    "class": "PhpOffice\\PhpSpreadsheet\\Reader\\Exception",
    "message": "Could not find zip member zip:///var/www/html/storage/framework/cache/laravel-excel/laravel-excel-xTdezz3OYmD8MnPBQhypTJrXfvQniokt.xlsx#_rels\\.rels",
    "code": 0,
    "file": "/var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/File.php:162",
    "trace": [
    "/var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php:427",
    "/var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/BaseReader.php:182",
    "/var/www/html/vendor/maatwebsite/excel/src/Writer.php:141",
    "/var/www/html/vendor/maatwebsite/excel/src/Jobs/AppendQueryToSheet.php:98",
    "/var/www/html/vendor/maatwebsite/excel/src/Jobs/Middleware/LocalizeJob.php:46",
    "/var/www/html/vendor/laravel/framework/src/Illuminate/Support/Traits/Localizable.php:19",
    "/var/www/html/vendor/maatwebsite/excel/src/Jobs/Middleware/LocalizeJob.php:45",
    "/var/www/html/vendor/maatwebsite/excel/src/Jobs/AppendQueryToSheet.php:93",
    "/var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36",
    "/var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php:43",
    "/var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:95",
    "/var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:35",
    "/var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:690",
    "/var/www/html/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:128",
    "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:144",
    "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:119",
    "/var/www/html/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:132",
    "/var/www/html/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php:124",


    When I have only one instance running, everything works as expected, and there are no errors. However, my architecture relies on auto-scaling and will typically use multiple instances to handle load. It appears this error may be related to the file being cached or stored locally on each instance, which isn’t shared across instances in the auto-scaling setup.

    Is there a recommended approach to handle storage for temporary or cache files in a multi-instance environment?

    Additionally, is there a way to configure the temporary file local_path to a cloud-based storage solution like Amazon S3? I see that local_path is used to define where temporary files are stored during export/import processes:

    'temporary_files' => [
    'local_path' => storage_path('framework/cache/laravel-excel'),
    // Other settings...
    ],


    Since we are running in a multi-instance environment, storing these temporary files locally on each instance creates issues with consistency across instances. If we could use a shared location, such as an S3 bucket, it might help avoid this issue. Any guidance on this would be greatly appreciated!

    Continue reading...

Compartilhe esta Página