aws / aws/aws-sdk-net

DynamoDBStreams - Unable to Create Document from Attribute Map After SDK v4 Upgrade

Open
#3,899 1 comment 0 reactions 0 assignees View on GitHub
bug dynamodb p2 potential-regression
Dominant language
C#
Stars
140
Forks
891
Avg merge
21h 51m
Merged PRs (30d)
10

Description

### Describe the bug

After upgrading to AWS SDK v4, it is no longer possible to create a Document from an attribute map due to the relocation of DynamoDB Streams models into a separate NuGet package.

### Regression Issue

- [x] Select this option if this issue appears to be a regression.

### Expected Behavior

The attribute map from a DynamoDB stream record should be convertible into a Document object as in previous SDK versions.

### Current Behavior

```
Argument 1: cannot convert from 'System.Collections.Generic.Dictionary' to 'System.Collections.Generic.Dictionary'
```

### Reproduction Steps

```csharp

getRecordsResponse = await dynamoDBStreams.GetRecordsAsync(recordsRequest, token);

foreach (Record record in getRecordsResponse.Records)
{
Profile? oldImage = null;
if (record.Dynamodb.OldImage is not null)
{
Document oldImageDocument = Document.FromAttributeMap(record.Dynamodb.OldImage); // Error
oldImage = JsonSerializer.Deserialize(oldImageDocument.ToJson());
}
}
```

### Possible Solution

Provide new static method to create a Document from the DynamoDBStreams models.

Creating a Document object is required to then serialize it as a JSON. An alternative of this could be to support direct JSON serialization of the DynamoDBStreams models, as it is done in the [Lambda SDK](https://github.com/aws/aws-lambda-dotnet/blob/release_2025-06-25/Libraries/src/Amazon.Lambda.DynamoDBEvents/ExtensionMethods.cs).

### Additional Information/Context

_No response_

### AWS .NET SDK and/or Package version used

AWSSDK.DynamoDBv2 - 4.0.1.9
AWSSDK.DynamoDBStreams - 4.0.0.11

### Targeted .NET Platform

.NET 8

### Operating System and version

Windows 11

Contributor guide

Open the contributing guide

Research direction

Start at Document.FromAttributeMap and compare its expected AttributeValue type with the Amazon.DynamoDBStreams.Model type used by record.Dynamodb.OldImage. The related Lambda approach is referenced in ExtensionMethods.cs. Done means the reproduced old-image conversion works with SDK v4 and the resulting data can still be serialized to JSON.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, csharp
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.