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

Error restoring binary attribute #38

Open
rofr opened this issue May 6, 2017 · 1 comment
Open

Error restoring binary attribute #38

rofr opened this issue May 6, 2017 · 1 comment

Comments

@rofr
Copy link

rofr commented May 6, 2017

I have a table with a binary attribute with base64 encoded strings. When I backup with base64binary : true and then restore, I get a different value in the restored table.

If I backup with base64binary : false, the restore fails with an error:

{ InvalidParameterType: Expected params.RequestItems['dev-rental-events'][24].PutRequest.Item['body'].B to be a string, Buffer, Stream, Blob, or typed array object

The json in the backup (without base64binary) looks like:
{"createdAt":{"S":"2017-05-02T09:50:52.322Z"},"stream":{"S":"rental"},"id":{"S":"2017-05-02T09:50:52.317Z0"},"name":{"S":"register"},"body":{"B":{"type":"Buffer","data":[101,121,74,112,90,67,73,54,73,106,73,53,73,105,119,105,90,109,108,121,99,51,82,102,98,109,70]}}}

While the json with base64binary looks like:

{"createdAt":{"S":"2017-05-02T09:51:19.258Z"},"stream":{"S":"rental"},"id":{"S":"2017-05-02T09:51:19.257Z2"},"name":{"S":"lock-applicant"},"body":{"B":"ZXlKaGNIQnNhV05oYm5RaU9pSXlPU0lzSW1KeWIydGxjaUk2SWtGa1lXMGlMQ0owYVcxbGMzUmhiWEFpT2lJeU1ERTNMVEExTFRBeVZEQTVPalV4T2pFNUxqSTFOMW9pZlE9PQ=="}}
Note that the string value of the body above is the exact same string I see in the dynamodb ui.

@rofr
Copy link
Author

rofr commented May 6, 2017

worth noting, my app base64 encodes some stringified json and stores the result with a binary attribute. Probably really bad design but nonetheless, taking a backup and then restoring should result in identical tables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant