You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The dynamodb stream is emitting it's changes in json string format, with binary values being base64 encoded. However when performing the putitem command through boto, these strings are assumed to be un-encoded and go through an additional base64 encoding.
I was able to resolve this by transforming the binary objects into their bytes representations before sending them through boto
if event_name == 'REMOVE':
keys_to_delete = record['dynamodb']['Keys']
# Look for binary values b64 decode them back into bytes
for key in keys_to_delete:
for valType in keys_to_delete[key]:
if valType == 'B':
keys_to_delete[key][valType] = base64.b64decode(keys_to_delete[key][valType])
dynamodb.delete_item(TableName=target_ddb_name,Key=record['dynamodb']['Keys'])
else:
#print("Putting item")
item_to_put = record['dynamodb']['NewImage']
# Look for binary values b64 decode them back into bytes
for property in item_to_put:
for valType in item_to_put[property]:
if valType == 'B':
item_to_put[property][valType] = base64.b64decode(item_to_put[property][valType])
dynamodb.put_item(TableName=target_ddb_name,Item=item_to_put)
The text was updated successfully, but these errors were encountered:
The dynamodb stream is emitting it's changes in json string format, with binary values being base64 encoded. However when performing the putitem command through boto, these strings are assumed to be un-encoded and go through an additional base64 encoding.
I was able to resolve this by transforming the binary objects into their bytes representations before sending them through boto
The text was updated successfully, but these errors were encountered: