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

Fix invalid record data returned after CBOR-encoded put request #111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dittos
Copy link

@dittos dittos commented Mar 23, 2021

Problem

  1. Put record with CBOR-encoded request (e.g. using AWS Java SDK)
  2. Get records -> malformed JSON response
{
    "Records": [
        ...
        {
            "SequenceNumber": "49616645143474350269062001186086684333515393213082370050",
            "ApproximateArrivalTimestamp": 1616506576.795,
            "Data": {
                "type": "Buffer",
                "data": [
                    104,
                    101,
                    108,
                    108,
                    111
                ]
            },
            "PartitionKey": "hello"
        },
        ...
    ],
    ...
}

Data should be base64-encoded string but Buffer object is stringified as-is.

Proposed fix

If Buffer is given as Blob typed parameter, convert it into base64-encoded string.

An alternative approach could be: encode Buffers when writing responses.

Related: #108

@obiwabrakenobi
Copy link

obiwabrakenobi commented Jun 24, 2022

👍 works for me as well. Any chance this will get merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants