Forum
S3 Uploads silently failing
I've migrated assets from perch/resources to S3 and wired up the buckets.php config file to reference each bucket used. Perch is correctly using these S3 assets, but uploading new assets silently fails. Perch thinks the upload completes successfully and includes what should be the correct asset URL, but the image tags are broken and the asset does not exist on S3.
Additionally, when selecting a broken image in gallery app and attempting to re-upload the image file, Perch outputs the following errors above the navbar:
I've verified the keys I'm using are valid by connecting via Transmit and adding/removing files to/from S3. I've tried with and without the bucket policy and CORS config detailed in this post, without any change.
Any ideas? Are you able to share the bucket policy and CORS settings you tested with?
Thanks in advance.
Diagnostic:
Perch Runway: 2.8.13, PHP: 5.6.10-1+deb.sury.org~trusty+1, MySQL: 5.5.43, with PDO
Server OS: Linux, apache2handler
Installed apps: content (2.8.13), assets (2.8.13), categories (2.8.13), perch_blog (4.6), perch_forms (1.8.3), perch_gallery (2.8.6)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_forms', 'perch_gallery' );
PERCH_LOGINPATH: /admin
PERCH_PATH: /var/www/admin
PERCH_CORE: /var/www/admin/core
PERCH_RESFILEPATH: /var/www/admin/resources
Image manipulation: GD Imagick
PHP limits: Max upload 32M, Max POST 32M, Memory: 512M, Total max file upload: 32M
Resource folder writeable: Yes
HTTP_HOST: 192.168.33.10
DOCUMENT_ROOT: /var/www/
REQUEST_URI: /admin/core/settings/diagnostics/
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
Could be a buckets.php issue - what does your entry look like?
Reduced test buckets.php examples:
This fails (attempting to write to bucket root):
As does this (attempting to write to directory within bucket):
As does this:
As does this:
The following bucket config does work with some image fields inside page regions, but does not work with buckets defined by Gallery app:
Instead of Gallery app uploading a new image to the bucket directory manually defined in buckets.php, Perch creates
bucketname/directoryname
insideperch/addons/apps/perch_gallery
, but still thinks the image is located on S3.Dynamic buckets from the Gallery app will not work - I believe they're created under the default bucket.
I was operating under the assumption that existing buckets created by Gallery app could use S3 if the bucket names were manually defined in
buckets.php
(This does work for displaying assets, FWIW). New albums created by Gallery app would then only exist on the server with the Perch install, and could later be moved to S3 once support improves. Is this not the case?That's right - if the items are in the bucket list then there should be no issue. The only issue might arise in dynamically creating new buckets on S3.
So in theory this should work. Any idea why images are uploading to perch/addons/apps/perch_gallery instead of S3, or additional steps I can take to troubleshoot?
That sounds like the path is missing so it's going into the local directory to me.
I'll have to dig into the Gallery app and take a look. It predates Runway.