deliciousbrains / wp-amazon-s3-and-cloudfront

Automatically copies media uploads to Amazon S3 for delivery. Optionally configure Amazon CloudFront for even faster delivery.
https://wordpress.org/plugins/amazon-s3-and-cloudfront/
304 stars 148 forks source link

Not able to fetch the buckets #376

Closed kites77 closed 7 years ago

kites77 commented 7 years ago

Hi When i try to change the bucket i'm getting this error.

Error fetching buckets — Missing required client configuration options: region: (string) A "region" configuration value is required for the "s3" service (e.g., "us-west-2"). A list of available public regions and endpoints can be found at http://docs.aws.amazon.com/general/latest/gr/rande.html.

Can you please help to solve this problem.

Thanks! 2017-05-19_1436

A5hleyRich commented 7 years ago

Hi,

This error usually occurs when a different version of the AWS SDK is being loaded. Could this be the case?

kites77 commented 7 years ago

Hi Ashley,

Thank you for your quick response.

Actually i don't have much idea about AWS SDK. I just upgraded the wordpress to latest version and i'm facing this issue.

Also On the amazon-s3-and-cloudfront plugin page i see this error.

2017-05-19_1712

Please help!!

Thanks, Shabeer

ianmjones commented 7 years ago

Hi Shabeer,

It sounds like you might have another plugin installed that has a different version (v3.x) of the AWS PHP SDK included.

kites77 commented 7 years ago

Hi Ian,

I have only these two plugins installed Amazon Web Services and WP Offload S3 Lite for offloading the images to S3 bucket.

How can I know which version of the AWS PHP SDK i'm I using and which version the above plugins will support?

Thanks!

ianmjones commented 7 years ago

@kites77 Please post your diagnostic info from the Help tab of WP Offload S3 Lite's settings page.

kites77 commented 7 years ago

Here is the diagnostic info.

site_url(): http://efacademyblog.ef.com/blog homeurl(): http://efacademyblog.ef.com/blog Database Name: WPProd Table Prefix: wp WordPress: 4.7.5 Web Server: Apache/2.4.7 (Ubuntu) PHP: 5.5.35-1+donate.sury.org~trusty+4 MySQL: 5.6.34 ext/mysqli: yes PHP Memory Limit: 128M WP Memory Limit: 40M Memory Usage: 11 MB Blocked External HTTP Requests: None WP Locale: en_US Organize uploads by month/year: Enabled WP_DEBUG: Yes WP_DEBUG_LOG: Yes WP_DEBUG_DISPLAY: No SCRIPT_DEBUG: No WP Max Upload Size: 2 MB PHP Time Limit: 30 PHP Error Log: /var/www/html/blog/wp-content/debug.log WP Cron: Enabled fsockopen: Enabled allow_url_fopen: Enabled OpenSSL: OpenSSL 1.0.2h 3 May 2016 cURL: Enabled Zlib Compression: Enabled PHP GD: Disabled Imagick: Disabled Basic Auth: Disabled Proxy: Disabled

Media Files: 5,800 Media Files on S3: 5,783 Number of Image Sizes: 6

Names and Dimensions of Image Sizes: thumbnail (none) medium (none) large (none) home-post-thumb (375x375) random-post-thumb (300x300)

WP_CONTENT_DIR: /var/www/html/blog/wp-content WP_CONTENT_URL: http://efacademyblog.ef.com/blog/wp-content UPLOADS: Not defined WP_PLUGIN_DIR: /var/www/html/blog/wp-content/plugins WP_PLUGIN_URL: http://efacademyblog.ef.com/blog/wp-content/plugins

AWS_USE_EC2_IAM_ROLE: Not defined AS3CF_BUCKET: Not defined AS3CF_ASSETS_BUCKET: Not defined AS3CF_REGION: Not defined

Bucket: academyblogimgdevtst Region: ap-southeast-1 Copy Files to S3: On Rewrite File URLs: On

Local URL: http://efacademyblog.ef.com/blog/wp‑content/uploads/2017/05/photo.jpg S3 URL: http://d4o2apwtqcg31.cloudfront.net/WPDev/wp‑content/uploads/2017/05/23091218/photo.jpg

Domain: cloudfront Enable Path: On Custom Path: WPDev/wp-content/uploads/ Use Year/Month: On Force HTTPS: Off Remove Files From Server: On Object Versioning: On

Active Theme Name: academy Active Theme Folder: academy

Active Plugins: Akismet Anti-Spam (v3.3.2) by Automattic Amazon Web Services (v1.0.2) by Delicious Brains Code Snippets (v2.8.4) by Shea Bunge Google Analytics for WordPress by MonsterInsights (v6.1.7) by MonsterInsights Google XML Sitemaps (v4.0.8) by Arne Brachhold Instagram Feed (v1.4.8) by Smash Balloon Integration: Yoast SEO & qTranslate-X (v1.1.1) by qTranslate Team Jetpack by WordPress.com (v4.9) by Automattic Lazy Load (v0.6.1) by Regenerate Thumbnails (v2.2.6) by Alex Mills (Viper007Bond) Snapchat Snapcode Widget (v1.1.1) by pipdig URL ShortCodes (v1.2) by Cathal Garvey User Role Editor (v4.32.3) by Vladimir Garagulya WP Example Content (v1.3) by Hivemind Labs, Inc. WP Offload S3 Lite (v1.1.6) by Delicious Brains WP Resized Image Quality (v2.1.2) by Mike Bijon, Etch Software WP-Mail-SMTP (v0.10.1) by Callum Macdonald Widget Content Blocks (v2.3.6) by Danny van Kooten XCloner - Site Backup and Restore (v4.0.4) by Liuta Ovidiu Yoast SEO (v4.7.1) by Team Yoast qTranslate-X (v3.4.6.8) by qTranslate Team

ianmjones commented 7 years ago

XCloner includes the AWS PHP SDK v3 and is likely causing the issue.

Unfortunately WP Offload S3 Lite only supports the AWS PHP SDK v2 as included in the Amazon Web Services plugin. We hope to update to v3 of the AWS PHP SDK in a future release.

kites77 commented 7 years ago

I disabled the XCloner plugin now it works perfectly fine, Thank so much for your help.

tino1b2be commented 5 years ago

I got this error and after some troubleshooting, turns out this plugin is not compatible with PHP 7. Downgraded to PHP 5.5 and works fine now.

ianmjones commented 5 years ago

@tino1b2be WP Offload Media Lite 2.0 was fully tested with various versions of PHP 7, including PHP 7.2.

Do you have any particular error messages and stack traces that you could share that point to PHP 7 incompatibility?

tino1b2be commented 5 years ago

I couldn't locate any error logs. There was nothing in my apache error.log. There were no logs on my CloudTrail logs. I enabled debugging in wp-config.php but nothing was logged. I was using PHP 7.2 on Amazon Linux 2... After reading the Readme.md on this repo which says "Requires PHP: 5.5", I downgraded to PHP 5.5 and it started working.

NB: it's still a fresh site, no posts or anything, very few plugins and as far as I know, WP Offlaod Media is the only one that uses the AWS SDK.

ianmjones commented 5 years ago

Hi @tino1b2be, "Requires PHP: 5.5" just refers to the minimum.

We've heard of other issues with Amazon Linux 2, seems that its bundled PHP modules aren't up to scratch.

Please could describe what was happening while using PHP 7 as opposed how it "started working" once you downgraded to PHP 5.5? Was WordPress working fine but WP Offload Media just couldn't talk to AWS? Were there any notices in the WordPress admin dashboard?

tino1b2be commented 5 years ago

When I was using PHP 7.2 (from the amzn2-extras.repo), the only error message I got was "Not able to fetch the buckets"...and I got this messages using all three different authentication options you have (IAM Roles, hard coded keys)... I couldn't locate any logs to troubleshoot the problem as I described earlier (nothing in error.log, wp-content/debug.log, CloudTrail). There were no error messages in the WP dashboard, the rest of the wordpress site was working fine and had been working fine before installing the plugin too.

I then uninstalled PHP 7 using sudo yum remove php*. I disabled the amzn2-extras.repo and installed the yum repo remi-php55. After this I installed the following php packages:

sudo yum install php php-cli php-common php-mysqlnd php-pdo php-pecl-jsonc php-pecl-zip php-xml

And it started working. I could list the buckets and upload to S3 as expected.

ianmjones commented 5 years ago

Thanks for the extra info @tino1b2be.

tino1b2be commented 5 years ago

Hey. Managed to reproduce the issue again. Fresh EC2 instance using Amazon Linux 2 AMI installed the following packages:

sudo yum update -y sudo amazon-linux-extras install -y lamp-mariadb10.2-php7.2 php7.2 sudo yum install -y httpd mariadb-server

Installed a fresh Wordpress site. the only plugin I added is WP Offload Media. I am using an instance profile which has full S3 permissions (also tried all the other methods of hard coding credentials. even gave it admin permissions).... I still receive this error. nothing in wp-content/debug.log Error message just says internal server error.

Any idea what could be causing this issue?

image

vipzen commented 5 years ago

Same issue here. PHP Version 7.3.5