aws-sdk-js-v3
aws-sdk-js-v3 copied to clipboard
Unmarshing DynamoStream events
Describe the bug
TS types seems to cause an issue when unmarshing a dynamoStream
Argument of type '{ [key: string]: AWSLambda.AttributeValue; }' is not assignable to parameter of type '{ [key: string]: import("/node_modules/@aws-sdk/client-dynamodb/dist/types/models/models_0").AttributeValue; }'.
Your environment
SDK version number
@aws-sdk/[email protected]
Steps to reproduce
import { DynamoDBStreamEvent } from 'aws-lambda'
import { unmarshall } from "@aws-sdk/util-dynamodb"
export const handler = async (event) => {
for (const record of event.Records) {
if (record.dynamodb?.NewImage) {
const streamItem = record.dynamodb?.NewImage
const item = unmarshall(streamItem)
console.log(item)
}
}
}
Observed behavior
receiving typing issue for AttributeValue type.
Expected behavior
should be able to unmarshall a Dynamo object, wherever the object comes from a stream event or a getItem action from the DynamoClient