I am trying to use the DynamoDB transactWrite function from node sdk (https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html#transactWrite-property)
For my lambda functions that are invoked by API Gateway triggers the function works as expected, but for my lambda functions invoked by DynamoDB Stream events I get the following error.
TypeError: n.transactWrite is not a function\n
All Lambda functions are on 10.X runtime.
Below is an example of how I am invoking the function with dummy data for illustrative purposes.
import { DynamoDB } from 'aws-sdk'
const dynamoDb: DynamoDB.DocumentClient = new DynamoDB.DocumentClient({})
const request: DynamoDB.DocumentClient.TransactWriteItemsInput = {
TransactItems: [{
Update: {
TableName: "example",
Key: {
partitionKey: "someid",
sortKey: "somesortkey",
},
UpdateExpression: 'set gsi1sk = :gsi1sk',
ExpressionAttributeValues: {
':gsi1sk': "somenewvalue"
},
},
}]
}
dynamoDb.transactWrite(request)
Is there a reduced feature set for DynamoDB invoked lambda functions ? Or an older version of SDK used or something ?