Documentation: Alternate Flysystem drivers leave watchdog error, do not work

Created on 18 Jun 2019  Â·  9Comments  Â·  Source: Islandora/documentation

At iCamp_EU we've been trying to get the Dropbox, ZIp, and SFTP Flysystem drivers to work. None are, and they all appear to leave the same error in the watchdog:

Symfony\Component\HttpKernel\Exception\HttpException: The destination directory does not exist, could not be created, or is not writable in Drupal\islandora\MediaSource\MediaSourceService->putToNode() (line 297 of /var/www/html/drupal/web/modules/contrib/islandora/src/MediaSource/MediaSourceService.php).

Here are two of the configurations we're trying. They are from settings.php:

  'zipexample' => [
    'driver' => 'zip',
    'config' => [
      'location' => '/tmp/ziptest.zip',
    ],
  ],

'sftpexample' => [
    'driver' => 'sftp',
    'config' => [
      'host' => 'xxx.xxx.xxx.xxx',
      'username' => 'islandora',
      // 'password' => 'password', // Only one of 'password' or 'privatekey' is needed.
      'privateKey' => '/home/vagrant/.ssh/id_rsa',
      'root' => '/home/islandora',

      // Optional
      'port' => 21,
      'timeout' => 10,
    ],
    'cache' => TRUE, // Cache filesystem metadata.
  ],

Can anyone replicate this error?

Most helpful comment

Make sure zip is installed on the vagrant.

All 9 comments

Some initial debugging here by @ibrahimab is showing that resolving the realpath of the filesystem URIs is returning FALSE.

@mjordan I can give it a go with zip and see what pops.

Make sure zip is installed on the vagrant.

We tried it successfully with Amazon S3. I'll see if I can find our ticket to see what I did but If I remember correctly there were some underlying dependencies that needed to be installed. Not sure about the sftp or others but for S3 needed to do composer require league/flysystem-aws-s3-v3

@mjordan I can confirm zip is failing. This is what I'm getting in the logs:

The upload directory zip://2019-06 for the file field field_media_image could not be created or is not accessible. A newly uploaded file could not be saved in this directory as a consequence, and the upload was canceled.

@dannylamb can you confirm that calling \Drupal::service('file_system')->realpath('zip://') is also returning false? I got the feeling the resolving of these uri's are the reason it is failing.

@ibrahimab yep

vagrant@claw:/var/www/html/drupal/web$ drush php:cli
Psy Shell v0.9.9 (PHP 7.2.19-1+ubuntu16.04.1+deb.sury.org+1 — cli) by Justin Hileman
>>> \Drupal::service('file_system')->realpath('zip://');
=> false

I have installed a fresh Drupal 8 project and installed flysystem. The same problem occurs, so it seems this has nothing to do with islandora, but the project itself. I also took a look at the flysystem repository and the last commit was 2 years ago. It would be wise to use another project. The other option would be taking over maintaining flysystem.

The SFTP driver seems to work if you paste the contents of the key instead of a file path for the privateKey config and comment out the port (or change it to 22 unless ssh really is running on port 21 on your SFTP server, I also commented out the timeout and cache for our tests ). I tried this on a remote build not a vagrant virtualbox install (I'm not sure if networking would cause issues when using vagrant vm?).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Natkeeran picture Natkeeran  Â·  3Comments

ruebot picture ruebot  Â·  4Comments

jonathangreen picture jonathangreen  Â·  4Comments

acoburn picture acoburn  Â·  5Comments

ruebot picture ruebot  Â·  4Comments