Closed hamiltondfp closed 6 years ago
You'r right, since you can't write to the heroku filesystem you can't write to that file - but we can still use all the other features of the plugin for security.
But the error you get has no relation to the issue you have with uploading media files. If you want to upload media files, than you need to provide heroku with an external storage.
Check out the Persistent Storage (Optional)
Step in the Deployment - Heroku - Manual
instructions in https://github.com/PhilippHeuer/wordpress-heroku/wiki/Deployment to use Amazon S3 as storage.
I actually do have S3 set up following those instructions.
I was assuming that maybe I wasn't even getting to the point of looking up the S3_AWS_URL because I was only getting the above error in the Papertrail logs.
I am using Bucketeer. I believe I am constructing the S3_AWS_URL the same way you are using the bucketeer variables here: https://github.com/PhilippHeuer/wordpress-heroku/blob/9b8ef96ca8a77bf4826f32bbfc1473815c823f50/config/plugins/heroku/heroku-bucketeer.php
Except where you use s3.amazonaws.com, I am using s3-BUCKETEER_AWS_REGION-amazonaws.com.
I have tried populating the AWS_S3_URL manually, and I have tried removing it and letting the above code construct the URL (which I believe will not work since my bucket is in us-east-1).
On a whim, I also tried encoding the '/' characters in my SECRET_ACCESS_KEY to %2F, but that didn't make a difference.
Also, I am getting this error in the WordPress UI
“1121f00.jpg” has failed to upload. The uploaded file could not be moved to uploads/2017/11.
This suggests that it is still trying to write locally, correct?
To clarify about the heroku filesystem, you can write to it locally, but the data is lost after a short while.
Your uploading issue occurs when you try to store the file locally, before it is uploaded to the external storage. I tried to reproduce your issue but it didn't happen to me when i followed the instructions in the wiki to deploy a new instance.
Did you modify anything else?
Hi, Have same isssu even tryed to change to: putenv(sprintf('AWS_S3_URL=s3://%s:%s@%s/%s', $env['user'], getenv("BUCKETEER_AWS_ACCESS_KEY_ID"), getenv("BUCKETEER_AWS_SECRET_ACCESS_KEY"), getenv("BUCKETEER_BUCKET_REGIONS"), getenv("BUCKETEER_BUCKET_NAME")));
Ok this what I did to make it work: in config/plugins/wordpress/wordpress-s3uploads.php change this: define('S3_UPLOADS_KEY', $env['user']); define('S3_UPLOADS_SECRET', $env['pass']); define('S3_UPLOADS_REGION', str_replace(array('s3-', '.amazonaws.com'), array('', ''), $env['host'])); define('S3_UPLOADS_BUCKET', ltrim($env['path'], '/'));
in to: define( 'S3_UPLOADS_BUCKET', 'my-bucket-name' ); define( 'S3_UPLOADS_KEY', 'my-aws-key' ); define( 'S3_UPLOADS_SECRET', 'my-aws-secret' ); define( 'S3_UPLOADS_REGION', 'my-s3-region );
and it work
Description of your issue
Get the above error in the logs when deploying to Heroku. Upon doing some research, it appears that Wordpress attempts to write to this file to hardcode ips for the firewall which is started before Wordpress is started and therefore can't use the db: https://wordpress.org/support/topic/unable-to-open-wp-contentwflogsips-php-for-reading-and-writing/
It is my understanding that there is no support for writing directly to disk in Heroku(?), so I am not sure how this is meant to be set up.
Steps to Reproduce
After following the directions for deploying to Heroku, got to Wordpress on Heroku installation and attempt to add a media. After dropping in an image to upload and the upload completes, I get a message in WordPress stating that that the image could not be uploaded and the above message in the logs.
Thanks