vendredi 19 janvier 2018

Why am I not able to parse JSON correctly with AWS SDK in Laravel?

I am using Laravel 5.5 with the AWS SDK for laravel (https://github.com/aws/aws-sdk-php-laravel).

I'm trying to do a simple request to establish that I'm connecting correctly. I believe I have my credentials all set and nothing points to that as an error.

Here is the function in my laravel controller that is being called:

 public function testData(Request $request) {
    $sdk = new Sdk([
        'endpoint'   => 'http://localhost:80',
        'region'   => 'us-east-1',
        'version'  => 'latest'
    ]);

    $dynamodb = $sdk->createDynamoDb();
    $marshaler = new Marshaler();

    $tableName = 'funTalkDataStorage';

    $params = [
        'TableName' => $tableName
    ];

    try {
        $result = $dynamodb->query($params);

    } catch (DynamoDbException $e) {
        echo "Unable to query:\n";
        echo $e->getMessage() . "\n";
    }
}

The table 'funTalkDataStorage' does exist out on AWS already where there are two records already.

The thing that I'm not understanding is why I'm getting the following error from Laravel:

Aws \ Api \ Parser \ Exception \ ParserException Error parsing JSON: Syntax error

being thrown by :

aws\aws-sdk-php\src\Api\Parser\PayloadParserTrait.php

The error is originating from the line in my code:

$result = $dynamodb->query($params);

I've been digging through the sdk and searching the web and I'm just not getting where the issue is. Any help would be marvalous!



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2DqPj6i
via IFTTT

Aucun commentaire:

Enregistrer un commentaire