• I set up this plugin a long time ago using S3’s IAM Roles. And I’ve been able to use this plugin for months without problems.
    But today I noticed that I can’t upload files to S3 using this plugin.
    I confirmed that the following error message is displayed on the setting screen of this plugin.

    Error fetching buckets — Error retrieving credentials from the instance profile metadata service. (cURL error 28: Operation timed out after 1000 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html))

    My settings using IAM Roles worked fine with programs other than WordPress on the same server.
    After I changed the authentication method for this plugin to a method that defines Access Keys in wp-config.php, it worked fine.

    My environment is as follows.

    Table Prefix: wp_
    WordPress: 5.5.1
    Web Server: nginx/1.14.0
    PHP: 7.2.24-0ubuntu0.18.04.3
    MySQL: 5.7.30
    ext/mysqli: yes
    PHP Memory Limit: 128M
    WP Memory Limit: 40M
    Memory Usage: 10 MB
    Blocked External HTTP Requests: None
    WP Locale: ja
    Organize offloads by month/year: Enabled
    WP_DEBUG: No
    WP_DEBUG_LOG: No
    WP_DEBUG_DISPLAY: Yes
    SCRIPT_DEBUG: No
    WP Max Upload Size: 2 MB
    PHP Time Limit: 14400
    PHP Error Log:
    WP Cron: Enabled
    fsockopen: Enabled
    allow_url_fopen: Enabled
    OpenSSL: OpenSSL 1.1.1 11 Sep 2018
    cURL: 7.58.0
    Zlib Compression: Enabled
    PHP GD: 2.2.5
    Imagick: Enabled
    Basic Auth: Enabled
    Proxy: Disabled

    Media Files: 4,128
    Offloaded Media Files: 174
    Not Offloaded Media Files: 3,954

    Number of Image Sizes: 6

    Names and Dimensions of Image Sizes:
    thumbnail (150×150)
    medium (300×300)
    large (1024×1024)
    1536×1536 (1536×1536)
    2048×2048 (2048×2048)

    WP_CONTENT_DIR: /home/corporate-legal/corporate-legal/public/wp-content
    WP_CONTENT_URL: https://www.corporate-legal.jp/wp-content
    UPLOADS: Not defined
    WP_PLUGIN_DIR: /home/corporate-legal/corporate-legal/public/wp-content/plugins
    WP_PLUGIN_URL: https://www.corporate-legal.jp/wp-content/plugins

    AS3CF_PROVIDER: Not defined
    AS3CF_BUCKET: Not defined
    AS3CF_REGION: Not defined
    AS3CF_SETTINGS: Defined
    AS3CF_SETTINGS Keys: access-key-id, provider, secret-access-key

    Local URL:
    https://www.corporate‑legal.jp/wp‑content/uploads/2020/09/photo.jpg
    Offload URL:
    https://corporate‑legal.s3.ap‑northeast‑1.amazonaws.com/wp‑content/uploads/2020/09/07164231/photo.jpg

    OME Metadata Version: 8

    Storage Provider: Amazon S3
    Use Server Roles: Off
    Key File Path: N/A
    Access Keys Set: Yes
    Access Key ID Define: Not defined
    Secret Access Key Define: Not defined

    Bucket: corporate-legal
    Region: ap-northeast-1
    Block All Public Access: Disabled

    Copy Files to Bucket: On
    Enable Path: On
    Custom Path: wp-content/uploads/
    Use Year/Month: On
    Object Versioning: On

    Delivery Provider: Amazon S3
    Rewrite Media URLs: On

    Force HTTPS: Off

    Remove Files From Server: Off

    Active Theme Name: corporate-legal
    Active Theme Version: 0.1
    Active Theme Folder: corporate-legal

    Active Plugins:
    AdRotate (v5.8.7) by Arnan de Gans
    AddQuicktag (v2.5.3) by Frank Bültge
    Akismet Anti-Spam (v4.1.6) by Automattic
    All In One SEO Pack (v3.7.0) by All in One SEO Team
    Auto Featured Image (Auto Post Thumbnail) (v3.7.5) by Creativemotion
    Breadcrumb NavXT (v6.5.0) by John Havlik
    Broken Link Checker (v1.11.14) by WPMU DEV
    Change wp-admin login (v1.0.0) by Nuno Morais Sarmento
    Classic Editor (v1.6) by WordPress Contributors
    Contact Form 7 (v5.2.2) by Takayuki Miyoshi
    Corporate Legal Seminar API Package (v0.1) by K.Tanaka in Changing,LLC.
    Custom Post Type UI (v1.8.0) by WebDevStudios
    Easy Disable Visual Editor (v1.0) by Matt Martz
    Feedly Insight (v0.9.17 beta) by hayashikejinan
    Gravity Forms (v2.4.20) by Gravity Forms
    Jetpack by WordPress.com (v8.9) by Automattic
    Optimize Database after Deleting Revisions (v5.0) by CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
    PS Auto Sitemap (v1.1.9) by Hitoshi Omagari
    Pixabay Images (v3.4) by Simon Steinberger
    Redirection (v4.8) by John Godley
    Remove Widget Titles (v1.0) by Stephen Cronin
    Search Regex (v2.2.1) by John Godley
    Simple Local Avatars (v2.1.1) by Jake Goldman, 10up
    Simple Wp Sitemap (v1.2.1) by Webbjocke
    WP Fastest Cache (v0.9.1.0) by Emre Vona
    WP Fastest Cache Premium (v1.3.1) by Emre Vona
    WP Mail SMTP (v2.3.1) by WPForms
    WP Multibyte Patch (v2.9) by 倉石 政典
    WP Offload Media Lite (v2.4.3) by Delicious Brains
    WP Robots Txt (v1.1) by Christopher Davis
    WP Total Hacks (v4.7.2) by Takayuki Miyauchi
    WP Updates Notifier (v1.6.0) by Scott Cariss
    WP Webhooks (v2.0.6) by Ironikus
    WPFront User Role Editor (v2.14.4) by Syam Mohan
    WordPress Popular Posts (v5.2.4) by Hector Cabrera

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor ianmjones

    (@ianmjones)

    This is often solved by simply rebooting the instance as it’s usually a network/DNS issue.

    If that doesn’t help, please upgrade to the just released v2.4.4, that might possibly help as it has an update to the AWS PHP SDK.

    dav4

    (@dav4)

    @gcloudinc did you resolve the issue? I have the same problem on the 2.4.4 version. I had to back to 2.3.2 version and on that version, all works perfectly. After updating to 2.4.4 I can’t upload media and have the same error as you.

    I’m attaching settings from my wp-config.php

    define( 'AS3CF_SETTINGS', serialize(['domain' => 'cloudfront', 'cloudfront' => 'ASSETS.DOMAIN>COM', 'provider' => 'aws', 'use-server-roles' => true, 'bucket' => 'BUCKET_NAME', 'region' => 'eu-west-2', 'copy-to-s3' => true, 'serve-from-s3' => true, 'remove-local-file' => true]) );

    • This reply was modified 2 months ago by dav4.
    gcloudinc

    (@gcloudinc)

    @ianmjones

    Thank you for your reply.
    Sorry for the late reply.

    @dav4

    did you resolve the issue?

    I upgraded to 2.4.4, and I rebooted many times, but it was not solved.
    Ruby program on same server can upload file to S3 by IAM Roles way.
    I use by access key and secret way in WordPress.

    Plugin Author Delicious Brains Inc.

    (@deliciousbrains)

    We’ve not really heard of any problems with using IAM Roles since WP Offload Media 2.4.4 was released, so I suspect it is something unique to your setups, possibly permissions.

    Please can you share the permissions policy (in JSON format) for the IAM Role that does not work with 2.4.4?

    If the policy is relatively restrictive, you may want to check out the updated Custom IAM Policy for Amazon S3 doc as there’s new requirements for 2.4+.

    https://deliciousbrains.com/wp-offload-media/doc/custom-iam-policy-for-amazon-s3/

    -IJ

    dav4

    (@dav4)

    I’ve checked my IAMs and it looks good (it covers Minimum IAM User Policy
    ).

    JSON attached below

    {
        "Statement": [
            {
                "Action": [
                    "s3:CreateBucket",
                    "s3:DeleteObject",
                    "s3:Put*",
                    "s3:Get*",
                    "s3:List*"
                ],
                "Resource": "arn:aws:s3:::ASSETS_BUCKET/*",
                "Effect": "Allow"
            },
            {
                "Action": [
                    "s3:GetBucketPublicAccessBlock",
                    "s3:GetBucketLocation",
                    "s3:CreateBucket",
                    "s3:ListBucket",
                    "s3:ListBucketMultipartUploads",
                    "s3:DeleteObject"
                ],
                "Resource": "arn:aws:s3:::ASSETS_BUCKET",
                "Effect": "Allow"
            }
        ]
    }
Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.