Jump to content

Bug: When using empty 'regions' in s3 storage and upgrading, you'll run into issues


Recommended Posts

Randomly ran into this one today when updating a dev site so I thought I'd open this up in here as well as a bug report

In v8, the 'region' field is not required when s3 storage is used as it shouldn't be. Not all s3 providers require, or supply it.. I upgraded a v8 dev install from v8 to v9 today, went to do a template cleanup (inside WHMCS) and got this:

InvalidArgumentException: 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. in /home/user/public_html/vendor/aws/aws-sdk-php/src/ClientResolver.php:1280

Did some digging into ClientResolver.php, and it seems that this can no longer handle empty regions properly. In v8 this works fine, but the upgrades to v9 make this not so much

My own digging and testing came up with the following solution which works:

In ClientResolver.php, around line 1260, replace _apply_region with this code


    public static function _apply_region($value, array &$args)
    {
        if (empty($value)) {
        $value  = 'auto';
//            self::_missing_region($args);
        }
        $args['region'] = $value;
    }

Keep in mind that this is going to be very specific, so get your provider's default region if you want and replace 'auto' with that. This works with CF storage though, very well.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated