dynamodb TransactWriteItems错误:请求了未知操作

时间:2019-06-21 18:42:12

标签: node.js amazon-dynamodb

我正在尝试使用TransactWriteItems更新多个项目,但是出现以下错误:

{ 
  UnknownOperationException: An unknown operation was requested.
     at Request.extractError (project-dir\node_modules\aws-sdk\lib\protocol\json.js:51:27)       
     at Request.callListeners (project-dir\node_modules\aws-sdk\lib\sequential_executor.js:106:20)
     at Request.emit (project-dir\node_modules\aws-sdk\lib\sequential_executor.js:78:10)
     at Request.emit (project-dir\node_modules\aws-sdk\lib\request.js:683:14)
     at Request.transition (project-dir\node_modules\aws-sdk\lib\request.js:22:10)
     at AcceptorStateMachine.runTo (project-dir\node_modules\aws-sdk\lib\state_machine.js:14:12)
     at project-dir\node_modules\aws-sdk\lib\state_machine.js:26:10
     at Request.<anonymous> (project-dir\node_modules\aws-sdk\lib\request.js:38:9)
     at Request.<anonymous> (project-dir\node_modules\aws-sdk\lib\request.js:685:12)
     at Request.callListeners (project-dir\node_modules\aws-sdk\lib\sequential_executor.js:116:18)

   message: 'An unknown operation was requested.',
   code: 'UnknownOperationException',
   time: 2019-06-21T18:28:46.776Z,
   requestId: '',
   statusCode: 400,
   retryable: false,
   retryDelay: 17.98291928629798 
}

我的代码如下:

const dynamodb = new aws.DynamoDB({ endpoint: "http://localhost:8000" });

const result = await dynamodb
 .transactWriteItems({
   TransactItems: [{
      "Update":{
       "TableName":"dbTable1",
       "Key":{
         "id": { "S":"table-primary-key-id-01"  }
       },
       "ConditionExpression": "#id = :id",
       "UpdateExpression":"set #orderNo = :orderNo",
       "ExpressionAttributeNames": {
           "#id": "id",
           "#orderNo":"orderNo"
       },
       "ExpressionAttributeValues":{
           ":id":{"S":"table-primary-key-id-01"},
           ":orderNo":{"N":"9"}
       }
    }
   }]
 })
 .promise();

任何帮助都是非常有意义的。提前致谢。

1 个答案:

答案 0 :(得分:0)

我看到您正在本地dynamodb实例上运行TransactWriteItems操作。不幸的是,AWS尚未实现对dynamodb本地实例的Transactions API调用的支持。