Skip to content

backup on flysystem sftp disk fails #1595

@design4business

Description

@design4business

disk on tinker ist working as expected

Psy Shell v0.11.8 (PHP 8.1.9 — cli) by Justin Hileman

Storage::disk('backup')->exists('example.txt');
=> false

Storage::disk('backup')->put('example.txt', 'Contents');
=> true

Storage::disk('backup')->exists('example.txt');
=> true

backup:run fails with

STFP Flysystem Conf

    'backup' => [
        'driver' => 'sftp',
        'host' => env('SFTP_HOST'),

        // Settings for basic authentication...
        'username' => env('SFTP_USERNAME'),
        //'password' => env('SFTP_PASSWORD'),

        // Settings for SSH key based authentication with encryption password...
        'privateKey' => env('SFTP_PRIVATE_KEY'),
        //'passphrase' => env('SFTP_PASSPHRASE'),

        // Optional SFTP Settings...
        // 'hostFingerprint' => env('SFTP_HOST_FINGERPRINT'),
        // 'maxTries' => 4,
        // 'passphrase' => env('SFTP_PASSPHRASE'),
        // 'port' => env('SFTP_PORT', 22),
         'root' => env('SFTP_ROOT', ''),
        // 'timeout' => 30,
        // 'useAgent' => true,
    ],

Spatie Backup Disk Conf

'disks' => [
'backup',
],

Errors

Copying zip failed because: Could not connect to disk backup because: ErrorException: foreach() argument must be of type array|object, bool given in /home/thisismyuserroot/html/vendor/league/flysystem-sftp-v3/SftpAdapter.php:277
Stack trace:
#0 /home/thisismyuserroot/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(259): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
#1 /home/thisismyuserroot/html/vendor/league/flysystem-sftp-v3/SftpAdapter.php(277): Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap{closure}()
#2 /home/thisismyuserroot/html/vendor/league/flysystem/src/Filesystem.php(113): League\Flysystem\PhpseclibV3\SftpAdapter->listContents()
#3 /home/thisismyuserroot/html/vendor/league/flysystem/src/DirectoryListing.php(33): League\Flysystem\Filesystem->pipeListing()
#4 [internal function]: League\Flysystem\DirectoryListing::League\Flysystem{closure}()
#5 /home/thisismyuserroot/html/vendor/league/flysystem/src/DirectoryListing.php(81): iterator_to_array()
#6 /home/thisismyuserroot/html/vendor/league/flysystem/src/DirectoryListing.php(56): League\Flysystem\DirectoryListing->toArray()
#7 /home/thisismyuserroot/html/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php(778): League\Flysystem\DirectoryListing->sortByPath()
#8 /home/thisismyuserroot/html/vendor/spatie/laravel-backup/src/BackupDestination/BackupDestination.php(140): Illuminate\Filesystem\FilesystemAdapter->files()
#9 /home/thisismyuserroot/html/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php(286): Spatie\Backup\BackupDestination\BackupDestination->isReachable()
#10 /home/thisismyuserroot/html/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(262): Spatie\Backup\Tasks\Backup\BackupJob->Spatie\Backup\Tasks\Backup{closure}()
#11 /home/thisismyuserroot/html/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php(304): Illuminate\Support\Collection->each()
#12 /home/thisismyuserroot/html/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php(168): Spatie\Backup\Tasks\Backup\BackupJob->copyToBackupDestinations()
#13 /home/thisismyuserroot/html/vendor/spatie/laravel-backup/src/Commands/BackupCommand.php(58): Spatie\Backup\Tasks\Backup\BackupJob->run()
#14 /home/thisismyuserroot/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Spatie\Backup\Commands\BackupCommand->handle()
#15 /home/thisismyuserroot/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container{closure}()
#16 /home/thisismyuserroot/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#17 /home/thisismyuserroot/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#18 /home/thisismyuserroot/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(651): Illuminate\Container\BoundMethod::call()
#19 /home/thisismyuserroot/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(144): Illuminate\Container\Container->call()
#20 /home/thisismyuserroot/html/vendor/symfony/console/Command/Command.php(308): Illuminate\Console\Command->execute()
#21 /home/thisismyuserroot/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(126): Symfony\Component\Console\Command\Command->run()
#22 /home/thisismyuserroot/html/vendor/spatie/laravel-backup/src/Commands/BaseCommand.php(28): Illuminate\Console\Command->run()
#23 /home/thisismyuserroot/html/vendor/symfony/console/Application.php(1002): Spatie\Backup\Commands\BaseCommand->run()
#24 /home/thisismyuserroot/html/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand()
#25 /home/thisismyuserroot/html/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#26 /home/thisismyuserroot/html/vendor/laravel/framework/src/Illuminate/Console/Application.php(102): Symfony\Component\Console\Application->run()
#27 /home/thisismyuserroot/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(155): Illuminate\Console\Application->run()
#28 /home/thisismyuserroot/html/artisan(37): Illuminate\Foundation\Console\Kernel->handle()
#29 {main}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions