-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
runInstances Error:Call to undefined method Error::getResponse() in yii2 #2319
Comments
Hi @alahoo This usually happens when the service (in this case EC2) is sending an invalid response to the SDK. Could you help me investigate by adding 'debug'=>true to your client constructor and posting the result here? It will print out a long log output, including the raw response from EC2- I believe they would send an XML error. Please post the raw response here when you get the chance, even if that gives you enough information to solve your problem. It will help me to demonstrate to the company why we need to have more forgiving error parsers that gracefully fail, and prevent problems like this from happening in the future. Thank you,
|
PHP Fatal error: Allowed memory size of 5377097728 bytes exhausted (tried to allocate 3219472384 bytes) in /data/data/omcs/assets/inc/aws/Aws/TraceMiddleware.php on line 261 Sorry,It's too big |
@alahoo I've encountered |
@DavidAnderson684, on a quick search, I don't believe we have any static calls in the SDK to a getResponse() method, we do have some that look similar in non-static contexts, so I'm wondering if the error you're getting is just being displayed in a confusing way. To help get to the source of this, could you give me the stack trace? If you have steps to reproduce the issue and/or the raw response from the service which you can obtain using the debug config option mentioned above, that would be helpful as well. |
@SamRemis The error is triggered here:
getResponse() on an Error object, but there's no such method on that object in the PHP manual.
|
Right, I can see where that issue would happen. Maybe it was supposed to be getMessage or something, I'll look into the commit history and get a patch out. Do you have any info on what error was actually thrown? |
@SamRemis Unfortunately I have no more than the error message - it was sent to us by a user from their logs. |
@DavidAnderson684, |
|
Confirm by changing [ ] to [x] below to ensure that it's a bug:
Describe the bug
Call runInstances Error:Call to undefined method Error::getResponse() in yii2
Version of AWS SDK for PHP?
Version 3.194.0
Version of PHP (
php -v
)?PHP 7.2.0 (cli) (built: Dec 15 2017 18:34:34) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies
To Reproduce (observed behavior)
`<?php
require(DIR . '/vendor/autoload.php');
require(DIR . '/vendor/yiisoft/yii2/Yii.php');
$config = require(DIR . '/config/web.php');
//(new yii\web\Application($config))->run();
//$yii2App = new yii\web\Application($config);
require(DIR . '/assets/inc/aws/aws-autoloader.php');
use Aws\Credentials\Credentials;
use Aws\Ec2\Ec2Client;
$credentials = new Credentials("ID","KEY");
$ec2Client = new Ec2Client([
'region' => "us-west-1",
'version' => '2016-11-15',
'credentials' => $credentials
]);
$ec2_argv = [
'MaxCount' => 2,
'MinCount' => 2,
'DryRun' => true,
'ImageId' => 'ami-xxxx',
'SubnetId' => 'subnet-xxxx',
'InstanceType' => 'c5.large',
];
$check = $ec2Client->runInstances($ec2_argv);
print_r($check);`
Screenshots
Additional context
`PHP Fatal error: Uncaught Error: Call to undefined method Error::getResponse() in /data/data/omcs/assets/inc/aws/Aws/Handler/GuzzleV6/GuzzleHandler.php:60
Stack trace:
#0 /data/data/omcs/assets/inc/aws/GuzzleHttp/Promise/Promise.php(204): Aws\Handler\GuzzleV6\GuzzleHandler::Aws\Handler\GuzzleV6{closure}(Object(Error))
#1 /data/data/omcs/assets/inc/aws/GuzzleHttp/Promise/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler(2, Object(Error), NULL)
#2 /data/data/omcs/assets/inc/aws/GuzzleHttp/Promise/TaskQueue.php(48): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{closure}()
#3 /data/data/omcs/assets/inc/aws/GuzzleHttp/Handler/CurlMultiHandler.php(118): GuzzleHttp\Promise\TaskQueue->run()
#4 /data/data/omcs/assets/inc/aws/GuzzleHttp/Handler/CurlMultiHandler.php(145): GuzzleHttp\Handler\CurlMultiHandler->tick()
#5 /data/data/omcs/assets/inc/aws/GuzzleHttp/Promise/Promise.php(248): GuzzleHttp\Handler\CurlMultiHandler->execute(true)
#6 /data/data/omcs/assets/inc/aws/GuzzleHttp/Promise/Promise.php(224): GuzzleHttp\Promise\Pr in /data/data/omcs/assets/inc/aws/Aws/Handler/GuzzleV6/GuzzleHandler.php on line 60
Fatal error: Uncaught Error: Call to undefined method Error::getResponse() in /data/data/omcs/assets/inc/aws/Aws/Handler/GuzzleV6/GuzzleHandler.php:60
Stack trace:
#0 /data/data/omcs/assets/inc/aws/GuzzleHttp/Promise/Promise.php(204): Aws\Handler\GuzzleV6\GuzzleHandler::Aws\Handler\GuzzleV6{closure}(Object(Error))
#1 /data/data/omcs/assets/inc/aws/GuzzleHttp/Promise/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler(2, Object(Error), NULL)
#2 /data/data/omcs/assets/inc/aws/GuzzleHttp/Promise/TaskQueue.php(48): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{closure}()
#3 /data/data/omcs/assets/inc/aws/GuzzleHttp/Handler/CurlMultiHandler.php(118): GuzzleHttp\Promise\TaskQueue->run()
#4 /data/data/omcs/assets/inc/aws/GuzzleHttp/Handler/CurlMultiHandler.php(145): GuzzleHttp\Handler\CurlMultiHandler->tick()
#5 /data/data/omcs/assets/inc/aws/GuzzleHttp/Promise/Promise.php(248): GuzzleHttp\Handler\CurlMultiHandler->execute(true)
#6 /data/data/omcs/assets/inc/aws/GuzzleHttp/Promise/Promise.php(224): GuzzleHttp\Promise\Pr in /data/data/omcs/assets/inc/aws/Aws/Handler/GuzzleV6/GuzzleHandler.php on line 60`
The text was updated successfully, but these errors were encountered: