quixio/quix-streams

`topic.deserialize` fails when `value_serializer` == `'json'`

Closed this issue · 3 comments

Version 2.7.0, but still present in the latest.

topic.deserialize calls self._value_serializer(value_bytes, ctx=ctx) rather than self._value_deserializer(value_bytes, ctx=ctx).

This fails when topic._value_serializer is JSONSerializer (the default when accessed via app.topic); and will either fail or produce incorrect results for other serializers.

Traceback (most recent call last):
...
    deserialized = kafka_topic.deserialize(message)
  File "/home/x/.venv/lib/python3.9/site-packages/quixstreams/models/topics/topic.py", line 288, in deserialize
    else self._value_serializer(value_bytes, ctx=ctx)
  File "/home/x/.venv/lib/python3.9/site-packages/quixstreams/models/serializers/json.py", line 26, in __call__
    return self._to_json(value)
  File "/home/x/.venv/lib/python3.9/site-packages/quixstreams/models/serializers/json.py", line 32, in _to_json
    raise SerializationError(str(exc)) from exc
quixstreams.models.serializers.exceptions.SerializationError: Type is not JSON serializable: bytes

topic.deserialize is also missing unit tests.

Welcome @mcrosier1 , and thanks for posting this issue!

We will definitely get this fixed ASAP.

Nice. Thank you for this!

Fixed in v2.8.1

Thanks for reporting it!