Forum

Thread tagged as: Problem, Runway

Amazon S3 bucket type broken in Runway 3?

If I define a Amazon S3 bucket in buckets.php, the assets panel won't display the images. Image template tags assigned to an amazon_s3 bucket won't load in the admin either (nor any content below it).

buckets.php:

<?php
    return [
        'cdn' => [
                 'type'      => 'amazon_s3',
                 'region'    => 'eu-west-1',
                 'web_path'  => 'https://cdn.hiddenireland.com',
                 'file_path' => 'hiddenireland-assets',
         ],
    ];

access key id and secret access key also added to runway.php

Other bucket types (file & dropbox) don't break it just the amazon_S3 type.

It's working on an older Runway (2.8.34) site so I thought Runway 3 might have a php7 requirement for S3 buckets but switching from php 5.6 to php7 in my local dev made no difference.

The S3 bucket policies, user/group permissions, etc are identical. Any ideas why this doesn't work on Runway 3?

Diagnostics:

Perch Runway: 3.0.10, PHP: 5.6.31, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO
Server OS: Darwin, apache2handler
Installed apps: content (3.0.10), assets (3.0.10), categories (3.0.10), perch_blog (5.6.1), perch_forms (1.9)
App runtimes: <?php $apps_list = [ 'perch_blog', 'perch_forms', ];
PERCH_LOGINPATH: /perch
PERCH_PATH: /Users/adam/Sites/hiddenireland.com/site/perch
PERCH_CORE: /Users/adam/Sites/hiddenireland.com/site/perch/core
PERCH_RESFILEPATH: /Users/adam/Sites/hiddenireland.com/site/perch/resources
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
HTTP_HOST: hiddenireland.dev
DOCUMENT_ROOT: /Users/adam/Sites/hiddenireland.com/site
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Adam Green

Adam Green 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you getting any errors? Did you update the paths in your config/runway.php when you upgraded?

Thanks Drew - no errors, just empty space under 'Listing Assets' heading on the assets page - the page just doesn't finish outputting the markup if I specify an amazon_s3 bucket type, regardless of whether I've entered the access_key_id & secret_access_key in runway.php.

Which paths need updating in runway.php? Although the site probably started early on in dev as Runway 2, it was upgraded and built for the most part on Runway 3.

The handler path in the Amazon S3 section in runway.php appears to be correct, i.e. the perch_s3 app is in the right place.

        'amazon_s3' => [

            'access_key_id'     => '',
            'secret_access_key' => '',
            'handler'           => 'PerchS3_ResourceBucket',
            'handler_path'      => PERCH_PATH.'/runway/apps/perch_s3/PerchS3_ResourceBucket.class.php',

        ],
Drew McLellan

Drew McLellan 2638 points
Perch Support

It looks like your credentials are missing.

I just removed them from the above above as I thought it best not to post them publicly! Anyway, even with the credentials, it's still broke. I've managed to connect and upload to the same S3 bucket with the same credentials from a separate, fresh install of Runway 3.0.10, so could the problem be something to do with having been upgraded from runway 2 to 3? If so, any idea for a workaround?

Or could the issue be related to the size of the database (about 25mb)? or the number of existing resources (> 6000)?

Many thanks again!

Drew McLellan

Drew McLellan 2638 points
Perch Support

It could be the upgrade - what's the difference between the two sites?

The site I can't get working was launched back in May (probably upgraded to Runway 3 during development late last year) so there's a lot of images & content. The one that's working is just a fresh and empty install of Runway 3.0.10 without any content that I installed locally to test this with (and set up for another project)... so quite different! They're both on my local MAMP dev. I noticed all the db tables in the upgraded site are prefixed by perch2_ and the fresh install by perch3_, but I guess that's to be expected?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, you'd expect that. The prefix is set in your config.php file at the time the system is installed, and it obviously wouldn't change even though the site is upgraded.

Ok, thanks Drew, any further thoughts on what might be causing this issue? Should I email you the full diagnostics? Any other suggestions to help debug & fix the problem?

Very anxious to get to working... thanks again!

Duncan Revell

Duncan Revell 78 points
Registered Developer

      'amazon_s3' => [
          
          'access_key_id'     => '',
          'secret_access_key' => '',
          'handler'           => 'PerchS3_ResourceBucket',
          'handler_path'      => PERCH_PATH.'/runway/apps/perch_s3/PerchS3_ResourceBucket.class.php',

      ],

You should have PERCH_CORE in there, not PERCH_PATH.

Well spotted Duncan, I really can't thank you enough! I must have missed this step during the upgrade process, it's right there in the docs.