Ido
Ido

Reputation: 171

Missing required client configuration options: version

I was trying to connect AWS DynamoDB to my PHP script, and when I opened the script on the browser by XAMPP, I got the following error:

Fatal error: Uncaught exception 'InvalidArgumentException` with message 'Missing required client configuration options: version: (string) A "version" configuration value is required. Specifying a version constraint ensures that your code will not be affected by a breaking change made to the service. For example, when using Amazon S3, you can lock your API version to "2006-03-01". Your build of the SDK has the following version(s) of "dynamodb": * "2012-08-10" * "2011-12-05" You may provide "latest" to the "version" configuration value to utilize the most recent available API version that your client's API provider can find. Note: Using 'latest' in a production application is not recommended. A list of available API versions can be found on each client's API documentation page: http://docs.aws.amazon.com/aws-sdk-php/v3/api/index.html. If you are unable to load a specific API version, then you may need to update your copy of the SDK.' in C:\Users\Lenovo\xampp\htdocs\public_html\zip\aws\Aws in C:\Users\Lenovo\xampp\htdocs\public_html\zip\aws\Aws\ClientResolver.php on line 364

This is the block of code from ClientResolver.php with line 364:

private function throwRequired(array $args)
{
    $missing = [];
    foreach ($this->argDefinitions as $k => $a) {
        if (empty($a['required'])
            || isset($a['default'])
            || array_key_exists($k, $args)
        ) {
            continue;
        }
        $missing[] = $this->getArgMessage($k, $args, true);
    $msg = "Missing required client configuration options: \n\n";
    $msg .= implode("\n\n", $missing);
    throw new IAE($msg); // This is line 364
}

Can you please help me fix this? I'm new to this whole topic of PHP.

Upvotes: 1

Views: 5632

Answers (1)

hassan
hassan

Reputation: 8308

Your build of the SDK has the following version(s) of "dynamodb": * "2012-08-10" * "2011-12-05" You may provide "latest" to the "version" configuration value to utilize the most recent available

you need to identify your version to the client object , for instance :

$client = DynamoDbClient::factory(array(
    ....
    'version' => '2012-08-10',
));

You can find the list of versions here http://docs.aws.amazon.com/aws-sdk-php/v3/api/index.html

Upvotes: 4

Related Questions