I have a kinesis stream which has data with its original value as Base64 encoded . As Kinesis by default encodes all its data to Base64, I have to do a Base64decode to getdata from the Kinesis DataBlob . But since the originalData is also Base64 while decoding the originalData gets Corrupted/decoded and I donot want my Originaldata to get decoded. My code resides in a lambda which is triggered by an SQS and I cannot make Kinesis as the trigger . I have observed that this issue will not come if the trigger is Kinesis. Could you please suggest how can I extract the Original Data without decoding/Corrupting it ?
EDIT : Adding few more points . The SQS which is the trigger for this lambda01 is the Destination Queue for failed messages of another lambda02 that consumes the Kinesis . On failure the record details (ShardID and SequenceNumber of Kinesis) get pushed to the SQS and lambda01 will get these details do the getRecord from Kinesis based on this data .Lambda02 which is triggered by the Kinesis consumes the Kinesis but doesnot alter/push any records the Kinesis . Some Sample Data
Sample Data pushed to Kinesis: { "Attribute1": "<Base64EncodedValue>", "Attribute2:"value1" }
nodejs Code used to decodeBase64
const decodedRecord= Buffer.from(recordFromKinesis.data, 'base64').toString();
I need the Attribute1 value to be intact.