DynamoDB Javascript v3 API GetItemCommand UnknownOperationException

0

I'm trying to use the JavaScript v3 api to retrieve a single item from DynamoDB in a nodejs lambda. I'm getting UnknownOperationException. Here's the parameter object I'm passing into GetItemCommand:

{
    "TableName": "test_biblestudy_tools_user",
    "Key": {
        "userid": {
            "S": "06f4dc4b-3368-4277-9dbe-892edec668c6"
        }
    },
    "ProjectionExpression": "email"
}

The lambda's execution role has GetItem on the table.

One thing I wanted to do was turn on HTTP wire tracing for this, but I didn't see any example of how to do that when using the JavaScript v3 api. Right now all I'm configuring is the region, and I don't know how to configure anything else:

import { DynamoDBClient, GetItemCommand, TransactWriteItemsCommand } from '@aws-sdk/client-dynamodb';
const db_client = new DynamoDBClient({ region: 'us-east-1' });

How can I configure this client for http wire trace? Would that likely show me something useful here? I tried CloudTrail Data Plane Event Logging, but the failed call doesn't create a log.

Here's the full error from the CloudWatch log:

UnknownOperationException: UnknownError
      at throwDefaultError (/var/task/node_modules/@aws-sdk/client-dynamodb/node_modules/@aws-sdk/smithy-client/dist-cjs/default-error-handler.js:8:22)
      at deserializeAws_json1_0GetItemCommandError (/var/task/node_modules/@aws-sdk/client-dynamodb/dist-cjs/protocols/Aws_json1_0.js:1740:51)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
      at async /var/task/node_modules/@aws-sdk/client-dynamodb/node_modules/@aws-sdk/middleware-serde/dist-cjs/deserializerMiddleware.js:7:24
      at async StandardRetryStrategy.retry (/var/task/node_modules/@aws-sdk/middleware-retry/dist-cjs/StandardRetryStrategy.js:51:46)
      at async /var/task/node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:6:22
      at async Runtime.handler (file:///var/task/index.js:139:23) {
    '$fault': 'client',
    '$metadata': {
      httpStatusCode: 400,
      requestId: 'c688c34f-7c64-4d9a-9eb4-3258ee5aecf6',
      extendedRequestId: undefined,
      cfId: undefined,
      attempts: 1,
      totalRetryDelay: 0
    },
    __type: 'com.amazon.coral.service#UnknownOperationException'
  }
  • Please share the full code snippet you are trying to execute.

2 Answers
0
Accepted Answer

I found my error. I was calling client.send(new GetItemCommand(...)) with a client that had been instantiated from a different service! That explains the UnknownOperationException. Thanks for asking me to post the entire code snipped I was running. That's what led to me spotting the error.

answered 14 days ago
-1

I need you to check whether you are calling with a client having a request that might be originated from a different service ?

SUPPORT ENGINEER
answered 12 days ago
  • What is the relevance of this answer?

  • This did turn out to be my problem. My UnknownOperationException was being thrown because I was instantiating a client for Cognito and then using that client to execute a DDB command.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions