Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add region configuration in the S3 destination settings #65

Open
sillygwailo opened this issue May 21, 2021 · 0 comments
Open

Add region configuration in the S3 destination settings #65

sillygwailo opened this issue May 21, 2021 · 0 comments
Assignees

Comments

@sillygwailo
Copy link
Member

I have an S3 bucket that I back up to that's in the ca-central-1 AWS region, and it won't back up, and I get this error, because the library assumes the us-east-1 AWS region:

User warning: S3::putObject(): [AuthorizationHeaderMalformed] The authorization header is malformed; the region 'us-east-1' is wrong; expecting 'ca-central-1' in S3::__triggerError() (line 440 of /var/www/b/libraries/amazon-s3-php-class/S3.php).

That error is from the S3 library, but I got around it by hacking the module and hard-coding it:

--- a/includes/destinations.s3.inc
+++ b/includes/destinations.s3.inc
@@ -172,6 +172,7 @@ class backup_migrate_destination_s3 extends backup_migrate_destination_remote {
         require_once $path . '/S3.php';
         if (!$this->s3 && !empty($this->dest_url['user'])) {
           $this->s3 = new S3($this->dest_url['user'], $this->dest_url['pass']);
+          $this->s3->setRegion('ca-central-1');
         }
         return $this->s3;
       }

https://www.drupal.org/project/backup_migrate/issues/3027843#comment-13236642 has a patch for the D8 version of the module that seems to add a region field, which is what I'd ultimately prefer.

@quackers8me quackers8me self-assigned this May 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants