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

Where is "Aws\Common\Aws" ? #95

Open
twmbx opened this issue Apr 29, 2016 · 15 comments
Open

Where is "Aws\Common\Aws" ? #95

twmbx opened this issue Apr 29, 2016 · 15 comments
Labels

Comments

@twmbx
Copy link

twmbx commented Apr 29, 2016

Have I done something wrong?
Just installed S3-Uploads & can't get verify or create-iam-user to work because of

Fatal error: Uncaught Error: Class 'Aws\Common\Aws' not found

When I checked the aws sdk autoloader, I can't seem to find a mapping for "Aws\Common\Aws" ... Just me?

@spacedmonkey
Copy link
Contributor

Interesting I am getitng this

PHP Fatal error:  Class 'Aws\\Common\\Exception\\ServiceResponseException'

I wonder if it is related...

@twmbx
Copy link
Author

twmbx commented Apr 29, 2016

@spacedmonkey i would expect so, there are no "Aws\Common" mappings at all from what I could see.

@joehoyle
Copy link
Member

@twoSeats can you make sure you are using the latest stable release from https://github.com/humanmade/S3-Uploads/releases thanks!

@twmbx
Copy link
Author

twmbx commented Apr 29, 2016

@joehoyle oh is that what it is? I'll give that a shot.

@seostudio
Copy link

Same problem. Newest version installed.

@simonhampel
Copy link

Just setting this up for the first time - pulled the latest version, tried to run create-iam-user and had this problem with Aws\Common\Aws missing:

$ wp s3-uploads create-iam-user --admin-key=XXX --admin-secret=YYY
PHP Fatal error:  Uncaught Error: Class 'Aws\Common\Aws' not found in /srv/www/example.com/wp-content/plugins/s3-uploads/inc/class-s3-uploads-wp-cli-command.php:155
Stack trace:
#0 [internal function]: S3_Uploads_WP_CLI_Command->create_iam_user(Array, Array)
#1 phar:///usr/local/bin/wp/php/WP_CLI/Dispatcher/CommandFactory.php(67): call_user_func(Array, Array, Array)
#2 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#3 phar:///usr/local/bin/wp/php/WP_CLI/Dispatcher/Subcommand.php(351): call_user_func(Object(Closure), Array, Array)
#4 phar:///usr/local/bin/wp/php/WP_CLI/Runner.php(327): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
#5 phar:///usr/local/bin/wp/php/WP_CLI/Runner.php(334): WP_CLI\Runner->run_command(Array, Array)
#6 phar:///usr/local/bin/wp/php/WP_CLI/Runner.php(757): WP_CLI\Runner->_run_command()
#7 phar:///usr/local/bin/wp/php/wp-cli.php(21): WP_CLI\Runner->start()
#8 phar:///usr/local/bin/wp/php/boot-phar.php(5): include('phar:///usr/loc...')
#9 / in /srv/www/example.com/wp-content/plugins/s3-uploads/inc/class-s3-uploads-wp-cli-command.php on line 155
Fatal error: Uncaught Error: Class 'Aws\Common\Aws' not found in /srv/www/example.com/wp-content/plugins/s3-uploads/inc/class-s3-uploads-wp-cli-command.php:155
Stack trace:
#0 [internal function]: S3_Uploads_WP_CLI_Command->create_iam_user(Array, Array)
#1 phar:///usr/local/bin/wp/php/WP_CLI/Dispatcher/CommandFactory.php(67): call_user_func(Array, Array, Array)
#2 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#3 phar:///usr/local/bin/wp/php/WP_CLI/Dispatcher/Subcommand.php(351): call_user_func(Object(Closure), Array, Array)
#4 phar:///usr/local/bin/wp/php/WP_CLI/Runner.php(327): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
#5 phar:///usr/local/bin/wp/php/WP_CLI/Runner.php(334): WP_CLI\Runner->run_command(Array, Array)
#6 phar:///usr/local/bin/wp/php/WP_CLI/Runner.php(757): WP_CLI\Runner->_run_command()
#7 phar:///usr/local/bin/wp/php/wp-cli.php(21): WP_CLI\Runner->start()
#8 phar:///usr/local/bin/wp/php/boot-phar.php(5): include('phar:///usr/loc...')
#9 / in /srv/www/example.com/wp-content/plugins/s3-uploads/inc/class-s3-uploads-wp-cli-command.php on line 155

@uliporeggia
Copy link

uliporeggia commented Sep 24, 2016

Same problem as @simonhampel here

@posherry
Copy link

posherry commented Oct 7, 2016

Any update on this, I am facing the same problem...

@joehoyle
Copy link
Member

joehoyle commented Oct 8, 2016

I think this problem is coming from another copy of the AWS SDK being loaded which is a different version, could anyone confirm if they are using another aws sdk elsewhere in their codebase? Thanks!

@puckbag
Copy link

puckbag commented Oct 17, 2016

Aws\Common is old and does not exist in AWS-PHP-SDK v3 which is included in the current S3-Uploads v2 (beta).

#133 resolves this issue for me.

@andrewodri
Copy link

I just installed this plugin for the first time, and I am getting the error mentioned above. As @puckbag mentioned, it seems that the old SDK references are still present in the v2.0.0 release:

try {
$iam = Aws\Common\Aws::factory( array( 'key' => $args_assoc['admin-key'], 'secret' => $args_assoc['admin-secret'] ) )->get( 'iam' );
$iam->createUser( array(
'UserName' => $username,
));

@dingo-d
Copy link

dingo-d commented May 21, 2018

From what I've plucked on the v3 of the sdk, the iam instance should be created using

Aws\Iam\IamClient

class.

Something like

$iam = new \Aws\Iam\IamClient( [
    'profile' => 'default',
    'region'  => S3_UPLOADS_REGION,
    'version' => 'latest',
] );

The rest of the methods are the same.

https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-iam-2010-05-08.html

This assumes that the plugin is installed using composer, and that lib Aws is not used, but the one from vendors is used.

@ghost
Copy link

ghost commented Jun 1, 2018

I'm quite new to this, but I found that the solution by @dingo-d worked for me with some modification. I replaced this line:

$iam = Aws\Common\Aws::factory( array( 'key' => $args_assoc['admin-key'], 'secret' => $args_assoc['admin-secret'] ) )->get( 'iam' );

with this code:

$iam = new Aws\Iam\IamClient([
    'version' => 'latest',
    'region'  => S3_UPLOADS_REGION,
    'credentials' => [
        'secret' => $args_assoc['admin-secret'],
	'key' => $args_assoc['admin-key'],
    ],
]);

@dingo-d
Copy link

dingo-d commented Jun 2, 2018

Yeah, this should work if you are not using S3_UPLOADS_USE_INSTANCE_PROFILE 👍

JohnCrafton added a commit to PaidSites/S3-Uploads that referenced this issue Jan 29, 2019
@pixelbrad
Copy link

Ran into this issue just now on a fresh setup of v2.2.1 (latest stable at the time of writing).

@joehoyle joehoyle added the Bug label Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.