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

[Bug] Binary Data is not being correctly written to DynamoDb Outbox #2458

Closed
iancooper opened this issue Jan 5, 2023 · 0 comments · Fixed by #2560
Closed

[Bug] Binary Data is not being correctly written to DynamoDb Outbox #2458

iancooper opened this issue Jan 5, 2023 · 0 comments · Fixed by #2560
Assignees

Comments

@iancooper
Copy link
Member

Describe the bug

If the payload for a message is binary, then it is being mangled by the conversion between Message and MessageItem, which is using the Message Value property UTF-8 encoding on the bytes. We should be using Convert.ToBase64String when we have binary data.

To Reproduce

This has popped up where we are writing a Kafka payload with a payload header of the first 5 bytes of the message as:

magic byte (0) + 4byte schema-id

This means that although the payload after might well be JSON (although it could be Avro) we need to treat the content as it if were binary.

Suggested Fix

Where the body type is "application/octet-stream" we should treat the data as binary and use Convert.ToBase64String and not Encoding.UTF8.GetString. The simplest approach may be to fix this in the Message property which means we get this for 'free' wherever anyone marks up their content as "application/octet-stream"

@iancooper iancooper self-assigned this Jan 5, 2023
@iancooper iancooper changed the title Binary Data is not being correctly written to DynamoDb Outbox [Bug] Binary Data is not being correctly written to DynamoDb Outbox Jan 5, 2023
@iancooper iancooper linked a pull request Apr 17, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant