Skip to content

Conversation

simolus3
Copy link
Contributor

The binary_data field on sync requests is supposed to be true if clients will receive data as BSON documents instead of as JSON.

Since the sync service knows which format it'll use, this field doesn't actually have to be set by clients at all. Indeed it's not supposed to, but the Rust client sends it anyway. This could lead to an inconsistency between binary_data being true and binary data actually being sent:

  1. Requesting a sync stream with Accept: application/vnd.powersync.bson-stream errors if binary_data is not explicitly set to true in the request, because we're encoding values as BSON but bucketDataBatch things it's JSON.
  2. Requesting a sync stream via HTTP and JSON, but also setting binary_data: true is a near-miss. This is what happens today with the Rust sync client, this only works because the unencoded events emitted by bucketDataBatch are serialized in the ndjson transformer.
  3. For web socket streams, nothing has changed, except that binary_data is now passed as a separate parameter to the sync stream.

@simolus3 simolus3 requested a review from rkistner August 20, 2025 12:25
Copy link

changeset-bot bot commented Aug 20, 2025

🦋 Changeset detected

Latest commit: 1f1d25c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@powersync/service-core Patch
@powersync/service-core-tests Patch
@powersync/service-module-core Patch
@powersync/service-module-mongodb-storage Patch
@powersync/service-module-mongodb Patch
@powersync/service-module-mysql Patch
@powersync/service-module-postgres-storage Patch
@powersync/service-module-postgres Patch
@powersync/service-image Patch
test-client Patch
@powersync/service-schema Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

rkistner
rkistner previously approved these changes Aug 20, 2025
@simolus3 simolus3 merged commit 29a368e into main Aug 20, 2025
21 checks passed
@simolus3 simolus3 deleted the remove-binary-data-field branch August 20, 2025 14:08
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