Topic on Extension talk:AWS

Jump to navigation Jump to search

Exception & cannot create directory

6
Summary by Edward Chernenko

archived, not applicable to the current version of extension (as of 10 Oct 2018)

KraizeeM (talkcontribs)

On all pages of the wiki when enabling the AWS extension I get this error at the very bottom of the page;

Exception encountered, of type "Aws\Common\Exception\InvalidArgumentException"

And then when attempting to upload I get this;

Could not create directory ‘mwstore://AmazonS3/local-public/2/26’.

My config is in this format;

require_once("$IP/extensions/AWS/AWS.php");

$wgFileBackends['s3'] = array(

    'name'        => 'AmazonS3',

    'class'       => 'AmazonS3FileBackend',

    'lockManager' => 'nullLockManager',

    'awsKey'      => '****',

    'awsSecret'   => '****',

    'awsRegion'   => 'eu-west-1',

    'containerPaths' => array(

        'wiki_id-local-public'  => 'https://publicbucketname.s3-website-eu-west-1.amazonaws.com/',

        'wiki_id-local-thumb'   => 'https://thumbbucketname.s3-website-eu-west-1.amazonaws.com/',

        'wiki_id-local-deleted' => 'https://deletedbucketname.s3-website-eu-west-1.amazonaws.com/',

        'wiki_id-local-temp'    => 'https://tempbucketname.s3-website-eu-west-1.amazonaws.com/',

    )

);

$wgLocalFileRepo = array(

    'class'           => 'LocalRepo',

    'name'            => 'local',

    'backend'         => 'AmazonS3',

    'scriptDirUrl'    => $wgScriptPath,

    'scriptExtension' => $wgScriptExtension,

    'url'             => $wgScriptPath . '/img_auth.php',

    'zone'            => array(

        'public'  => array( 'container' => 'public' ),

        'thumb'   => array( 'container' => 'thumb' ),

        'temp'    => array( 'container' => 'temp' ),

        'deleted' => array( 'container' => 'deleted' )

    )

);

Karlpietsch (talkcontribs)

try this:

$wgAWSRegion = 'eu-west-1';

$wgFileBackends['s3']['containerPaths'] = array(
    'wiki_id-local-public' => 'publicbucketname,
    'wiki_id-local-thumb' => 'thumbbucketname',
    'wiki_id-local-deleted' => 'deletedbucketname',
    'wiki_id-local-temp' => 'tempbucketname'
);

// Make MediaWiki use Amazon S3 for file storage.
$wgLocalFileRepo = array (
    'class'             => 'LocalRepo',
    'name'              => 'local',
    'backend'           => 'AmazonS3',
    'scriptDirUrl'      => $wgScriptPath,
    'scriptExtension'   => $wgScriptExtension,
    'url'               => $wgScriptPath . '/img_auth.php',
    'zones'             => array(
        'public'  => array( 'url' => 'http://publicbucketname.s3-eu-west-1.amazonaws.com/' ),
        'thumb'   => array( 'url' => 'http://thumbbucketname.s3-eu-west-1.amazonaws.com/' ),
        'temp'    => array( 'url' => 'http://tempbucketname.s3-eu-west-1.amazonaws.com/' ),
        'deleted' => array( 'url' => 'http://deletedbucketname.s3-eu-west-1.amazonaws.com/' )
    )
);
KraizeeM (talkcontribs)

Where should the key/secret go with that?

Karlpietsch (talkcontribs)

just add

$wgAWSCredentials = array(

   'key' => 'yourkey',
   'secret' => 'yoursecret'

);

KraizeeM (talkcontribs)

If I change the config to that I get this error;

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wiki/includes/OutputPage.php:2322) in /var/www/html/wiki/includes/WebResponse.php on line 37

KraizeeM (talkcontribs)