Skip to content

Fix DynamoDB ExclusiveStartKey handling for AWS SDK v4#9884

Merged
ReubenBond merged 2 commits intodotnet:mainfrom
ReubenBond:fix/dynamodb-exclusive-start-key
Jan 20, 2026
Merged

Fix DynamoDB ExclusiveStartKey handling for AWS SDK v4#9884
ReubenBond merged 2 commits intodotnet:mainfrom
ReubenBond:fix/dynamodb-exclusive-start-key

Conversation

@ReubenBond
Copy link
Copy Markdown
Member

@ReubenBond ReubenBond commented Jan 20, 2026

Summary

Fixes DynamoDB provider test failures introduced by the AWS SDK v4 upgrade in PR #9659.

Problem

The AWS SDK v4 has stricter validation for the ExclusiveStartKey parameter in Scan and Query operations. Previously, the code initialized exclusiveStartKey as an empty dictionary and always passed it to ScanRequest.ExclusiveStartKey. The new SDK version treats an empty dictionary as an invalid key rather than ignoring it, causing the error:

Amazon.DynamoDBv2.AmazonDynamoDBException: The provided starting key is invalid

This affected multiple tests including:

  • MembershipTable_DynamoDB_GetGateways
  • Liveness_AWS_DynamoDB_* tests

Fix

  • Initialize exclusiveStartKey as null in ScanAsync instead of an empty dictionary
  • Only set ExclusiveStartKey on the request when it has a valid value (not null)
  • Apply the same pattern to QueryAsync for consistency

Testing

  • All DynamoDB-related projects build successfully
  • The fix addresses the root cause identified in the CI failure logs
Microsoft Reviewers: Open in CodeFlow

The AWS SDK v4 upgrade (PR dotnet#9659) introduced stricter validation for
the ExclusiveStartKey parameter in Scan and Query operations. An empty
dictionary is now treated as an invalid key rather than being ignored.

This fix:
- Initializes exclusiveStartKey as null in ScanAsync instead of empty dict
- Only sets ExclusiveStartKey on the request when it has a valid value
- Applies the same pattern to QueryAsync for consistency

Fixes test failures in AWS DynamoDB provider tests with error:
'The provided starting key is invalid'
Copilot AI review requested due to automatic review settings January 20, 2026 22:01
@ReubenBond ReubenBond enabled auto-merge January 20, 2026 22:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes DynamoDB provider test failures caused by stricter validation in AWS SDK v4. The SDK now treats empty dictionaries as invalid pagination keys rather than ignoring them, leading to "The provided starting key is invalid" errors in Scan and Query operations.

Changes:

  • Modified QueryAsync to conditionally set ExclusiveStartKey only when the pagination key is not null and not empty
  • Modified ScanAsync to initialize the pagination key as null instead of an empty dictionary and conditionally set ExclusiveStartKey only when not null

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ReubenBond ReubenBond added this pull request to the merge queue Jan 20, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 20, 2026
@ReubenBond ReubenBond added this pull request to the merge queue Jan 20, 2026
Merged via the queue into dotnet:main with commit 00ba0bd Jan 20, 2026
59 checks passed
@ReubenBond ReubenBond deleted the fix/dynamodb-exclusive-start-key branch January 20, 2026 23:50
@DarraghStauntonAngstrom
Copy link
Copy Markdown

Hey
Just wondering if you have any idea when this would get released?
It's currently stopping us from upgrading to Orleans 10/AWSSDK v4

@ReubenBond
Copy link
Copy Markdown
Member Author

Hi @DarraghStauntonAngstrom, I'm working on it now. Hopefully we have a release in the coming hours. I'll notify this thread when we do

@ReubenBond
Copy link
Copy Markdown
Member Author

v10.0.1 is now available

@DarraghStauntonAngstrom
Copy link
Copy Markdown

@ReubenBond Thanks so much! Really appreciate it!

@github-actions github-actions bot locked and limited conversation to collaborators Mar 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants