.netamazon-web-servicesaws-sdkamazon-kinesisamazon-qldb

Amazon.IonDotnet.Internals.Text.InvalidTokenException error while reading stream data from AWS Kinesis by QLDB stream


I have a running solution doing some operation on AWS QLDB. All workloads are developed with .NET. So far no problem...

Now I am just trying to stream QLDB data. The data in QLDB is streamed with AWS Kinesis as a built-in feature of QLDB.

I am trying to read the data from Kinesis Stream with .NET SDKs.

While I read data stream,

IonLoader.Default.Load(record.Data)

I get the following error

Amazon.IonDotnet.Internals.Text.InvalidTokenException: Token � : 65533 is not expected

I got this error randomly...Not sure about the root cause.

When I check the stream data in Kinesis, I noticed this strange pattern. And I am pretty sure that errors are for those data.

Any suggestion would be great?

enter image description here


Solution

  • You may have Kinesis record aggregation enabled as it's enabled by default for QLDB streams.

    This short documentation links out to an AWS labs implementation for a few languages: https://github.com/awslabs/kinesis-aggregation. C# is not implemented, so you would either have to implement a C# deaggregator yourself or turn off record aggregation for your stream in the QLDB console.