Unable to retrieve binary documents with TransactionAttemptContext
Description
Environment
Gerrit Reviews
Release Notes Description
Attachments
Activity

Jared Casey April 9, 2024 at 9:39 PM
Hi – I have a change coming to the SDK that will prevent the silent crash in this scenario. However, I need to stress that currently the SDKs do no support binary documents w/ transactions. By design, the transactions spec assumes JSON data. So, while the SDK will no longer crash in this scenario, I doubt you will get the behavior ottoman.js is looking for when using transactions if using binary documents.
Some good news though: w/in the last couple of weeks an update for the transactions spec to support binary data has been added. The problem will come down to priorities as we first need to implement changes w/in the C++ core and then we can implement binary support w/in the wrapper SDKs. If possible, I would recommend a CBSE as that will help PM w/ priorities (can link this JSCBC).
Please let me know if you have any questions.
Description
Fetching binary/plaintext documents via a TransactionAttemptContext seems to fail, and exits without any information. `ctx.get()` for a normal JSON document works, as does fetching the binary doc with `collection.get()`.
This was discovered when implementing transactions on Ottoman, as we use binary docs for our refdoc implementation. The offending lines are here: https://github.com/couchbaselabs/node-ottoman/pull/758/files#diff-dbfff5681984fd751309a6ef8fbc810eeba678c07dc87f873ff9fec7f18158caR38-R46
Actual Behavior
Using `ctx.get()` with a binary document's ID doesn't return the document, and exits without additional info.
Expected Behavior
Using `ctx.get()` with a binary document's ID should return the document the same way it does for JSON documents.
Evidence
The attached `index.js` file attempts to get three documents (a JSON doc via ctx, a binary doc via collection, and a binary doc via ctx), the first two of which work fine, but it never gets past the last one.
Steps to Reproduce
Create binary and JSON documents in `travel-sample._default.users` collection (or adjust the bucket/scope/collection in index.js) and run index.js
Observe first two console.log() statements show documents retrieved, but we never make it to the third