Closed jwtrim closed 5 months ago
Hi @jwtrim ,
When you are using the Document client you are abstracting away the need to define each item with their corresponding Dynamo attribute types and instead you can supply the value directly as native JS types (strings in this case). Therefore your code should look something like:
TransactItems: [
{
Put: {
TableName: 'test-table-v1-local',
Item: {
- PK: { S: 'test' },
- SK: { S: 'test' }
+ PK: 'test',
+ SK: 'test',
}
}
}
]
Feel free to revisit our lib-dynamo docs for further context about this.
Thanks, Ran~
@RanVaknin thanks for your response!
This does appear to fix my issue, but I swear I repeatedly tried that exact approach during my initial testing, yet somehow the exception persisted.
Anyhow, I can no longer reproduce so I will close this issue. Sorry for the inconvenience.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.
Checkboxes for prior research
Describe the bug
I am testing AWS Lambdas locally which store data in a DynamoDB table. The table has the following schema definition:
For the local environment, I am initializing a DynamoDBDocument client in the following way
When updating the table, I am trying to use the
client.transactWrite()
API with the following input:The API throws the following error:
I've had success using the
client.send(new PutCommand())
andAWS.DynamoDB({ endpoint: 'http://host.docker.internal:8000' }).transactWriteItems()
with the same item, but would need/prefer the other method to work.SDK version number
@aws-sdk/client-dynamodb@3.556.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v18.19.1
Reproduction Steps
Create a DynamoDB table with the provided schema and try to put a new document with the provided
TransactItems
list.Observed Behavior
The API throws the following error:
Expected Behavior
Document created successfully.
Possible Solution
No response
Additional Information/Context
No response