Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Putting already encoded DynamoJSON leads to double base64-encoded binary values #3291

Closed
thefirstofthe300 opened this issue Jun 6, 2022 · 2 comments
Assignees
Labels
bug This issue is a confirmed bug. dynamodb

Comments

@thefirstofthe300
Copy link

Describe the bug

I'm working on migrating some data in Dynamo into a new Dynamo account. I need to create a synchronization mechanism to prevent keep data up to date while I work on getting things cut over. The sync pipeline we've built involves using DynamoDB streams -> Lambda to update the new database.

The record fed to the lambda is a Python dict with the proper structure and encodings. None of the binary values are decoded from base64. I would expect that writing that record to the database using the boto3 client's put_item() function should send the data as is considering that the data isn't being decoded when being sent from Dynamo. However, in this case, it appears that binary values are base64 encoded by boto3 first.

Expected Behavior

boto3 shouldn't encode any values fed to the dynamodb client's put_item() function.

Current Behavior

boto3 is encoding binary values using base64 when using put_item()

Reproduction Steps

Run the code in this repo: https://github.com/thefirstofthe300/boto3-binary-encoding

The record.json contains a properly encoded record as the Lambda is receiving from DynamoDB streams.

Possible Solution

No response

Additional Information/Context

No response

SDK version used

boto3==1.24.2; botocore==1.27.2

Environment details (OS name and version, etc.)

macOS 12.4 with python 3.9.13

@thefirstofthe300 thefirstofthe300 added bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged. labels Jun 6, 2022
@tim-finnigan
Copy link
Contributor

Hi @thefirstofthe300 thanks for reaching out. It looks like this overlaps with an older issue in the CLI repository: aws/aws-cli#1097. Maybe you could try using one of the approaches in this comment.

@tim-finnigan tim-finnigan added dynamodb and removed needs-triage This issue or PR still needs to be triaged. labels Jun 8, 2022
@tim-finnigan tim-finnigan self-assigned this Sep 21, 2022
@tim-finnigan
Copy link
Contributor

We can continue tracking this in the issue mentioned above (aws/aws-cli#1097). Both the AWS CLI and boto3 are built on botocore (https://github.com/boto/botocore) so this relates to both repositories. I'll close this in favor of that issue since as it is older and has more comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a confirmed bug. dynamodb
Projects
None yet
Development

No branches or pull requests

2 participants