Skip to content

Unmarshing DynamoStream eventsΒ #2634

@maxm450

Description

@maxm450

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

Metadata

Metadata

Assignees

Labels

feature-requestNew feature or enhancement. May require GitHub community feedback.p3This is a minor priority issueworkaround-availableThis issue has a work around available.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions