Amazon DynamoDB updateTable SerializationException错误

时间:2017-04-28 19:35:56

标签: php amazon-web-services expression amazon-dynamodb

我正在尝试更新我的数据库中的一个二级索引,但是我收到以下错误

'Error executing "UpdateTable" on "https://dynamodb.us-east-1.amazonaws.com"; AWS HTTP error: Client error: 400 SerializationException (client): Start of structure or map found where not expected. - {"__type":"com.amazon.coral.service#SerializationException","Message":"Start of structure or map found where not expected."}' exception 'GuzzleHttp\Exception\ClientException' with message 'Client error: 400' in _aws/3.3.0/GuzzleHttp/Middleware.php:69 Stack trace: #0

无论我在哪里,我都找不到SerializationException错误。这是我的阵列设置

Array
(
    [TableName] => usuarios
    [GlobalSecondaryIndexUpdates] => Array
        (
            [Update] => Array
                (
                    [IndexName] => nombre-creado-index
                    [ProvisionedThroughput] => Array
                        (
                            [ReadCapacityUnits] => 50
                            [WriteCapacityUnits] => 50
                        )

                )

        )

)

无论我尝试什么,我都看不出错误的位置。我可以毫无问题地查询和更新表。我也可以运行describeTable并获得所有表格内容没有问题。我有什么想法可能有问题吗?

1 个答案:

答案 0 :(得分:0)

错误在数组中,是一个关联数组,而不是过程,这里是正确的设置

Array
(
    [TableName] => usuarios
    [GlobalSecondaryIndexUpdates] => Array
        (
            [0] => Array
                (
                    [Update] => Array
                        (
                            [IndexName] => nombre-creado-index
                            [ProvisionedThroughput] => Array
                                (
                                    [ReadCapacityUnits] => 50
                                    [WriteCapacityUnits] => 50
                                )

                        )

                )

        )

)