1
votes

Using the below PHP code to invoke lambda function but i am getting the below error. Looked at the PHP AWS api docuumentation not able to find whats causing issue. Receiving the below error from aws php sdk

PHP Warning:  Illegal string offset 'StatusCode' in /var/www/html/Guzzle/Service/Command/LocationVisitor/Response/StatusCodeVisitor.php on line 21
PHP Warning:  Illegal string offset 'FunctionError' in /var/www/html/Guzzle/Service/Command/LocationVisitor/Response/HeaderVisitor.php on line 24
PHP Warning:  Illegal string offset 'LogResult' in /var/www/html/Guzzle/Service/Command/LocationVisitor/Response/HeaderVisitor.php on line 24
PHP Catchable fatal error:  Argument 1 passed to Guzzle\Service\Resource\Model::__construct() must be of the type array, string given, called in /var/www/html/Guzzle/Service/Command/OperationResponseParser.php on line 86 and defined in /var/www/html/Guzzle/Service/Resource/Model.php on line 20


use Aws\Lambda\LambdaClient;
$client = LambdaClient::factory(array(
                    'credentials' => array(
                    'key'    => $f_key,
                    'secret' => $f_secret,
                   ),
                     'region'  => 'ap-southeast-2'
                ));
    try {

    echo "new invoke" . "\n";
    $result = $client->invoke(array(
        // FunctionName is required
        'FunctionName' => 'hello_wo’,
    ));
    }catch(Exception $e) {
      echo 'Error retrieving lambd error message code-' . $e->getCode . '-error message-' . $e->getMessage() ;
    }
1
could any one help me out regarding this - Arav

1 Answers

0
votes

Try this:

$client = LambdaClient::factory([
        'key' => $f_key,
        'secret' => $f_secret,
        'region' => 'ap-southeast-2'
    ]);